Adding rule with "From" option doesn't work

Thomas Graf tgraf at infradead.org
Tue May 3 04:34:38 EDT 2011


On Tue, May 03, 2011 at 10:03:38AM +0200, Romary Sonrier wrote:
> Hello guys,
> 
> I am using libnl 3.0 from git (cc33b0940f8ca0a34c9fbc085963e7887adc4db7)
> 
> I am trying to add rules to the kernel routing engine, using libnl.
> (kernel 2.6.35-28-generic x86_64 GNU/Linux / Ubuntu)
> 
> What i'm trying to do would be , with iproute2 :*ip rule add from
> 127.0.0.1 table 10 prio 100*
> 
> There is not any tool like  src/nl-rule-add.c yet, so i did my own , you
> can find it as attachement.
> 
> It seems that the call :*rtnl_rule_set_src(rule, a)* doesn't have any
> effect.
> 
> Do you have any idea?
> 
> I tried to compare with iproute2 code source, but that's not that easy.
> They use a struct "struct rtmsg", that is not use in libnl.
> 
> Any help would be welcome....

Can you run your program like this:

	NLCB=debug src/nl-rule-add

and post the output? That allows veryfing the netlink message that is being
sent to the kernel.



More information about the libnl mailing list