0

While browing through /proc, I am across /proc/net/fib_trie which seems to have main routing table of kernel inside it. My question is if modifying it will change the routing table or it is a stat only file?

(I want to modify routing table programmatically and I am total noob in C so looking for other options. File modification will be easy in any language)

In another question, MattSmith mentioned in a comment that modifying the file /proc/net/route and using ioctls is a solution, Can someone please guide me how?

Community
  • 1
  • 1
JuliandotNut
  • 1,169
  • 1
  • 12
  • 22

1 Answers1

2

My question is if modifying it will change the routing table or it is a stat only file?

No, route table won't change as file is read-only.

In another question, MattSmith mentioned in a comment that modifying the file /proc/net/route and using ioctls is a solution, Can someone please guide me how?

From user space perspective you can use netlink sockets to manage routing table. See some C example. However, it would be difficult for newcomer.

So the easiest way is to use ip utility(in fact it uses netlink sockets). That way, you can implement your own shell script and execute routing manipulations within it. You can search for proper usage of ip tool.

Community
  • 1
  • 1
Jurasic
  • 1,845
  • 1
  • 23
  • 29
  • it is *iproute2* package for shell. I know about it. My question is specifically about using programming language. – JuliandotNut Jun 13 '14 at 19:23
  • In fact, shell is scripting language and it's easy to get start with. So again, less time consuming option is to write shell script. The hard thing would be using netlink. – Jurasic Jun 13 '14 at 21:42