APIs for tc action mirred

Thomas Graf tgraf at suug.ch
Tue Jul 23 13:53:27 EDT 2013


On 07/23/13 at 01:22pm, Shriram Rajagopalan wrote:
> On Tue, Jul 23, 2013 at 12:29 PM, Thomas Graf <tgraf at suug.ch> wrote:
> >
> > On 07/20/13 at 01:10pm, Shriram Rajagopalan wrote:
> > > Hi,
> > >  I am trying to evaluate the possibility of programmatically doing the
> > > following using libnl. Can someone please tell me if the following can
> > > be done solely using libnl API in a c code or do I need to invoke an
> > > external script ?
> > >
> > > tc filter add dev vnet0 parent ffff: proto ip pref 10 \
> > >            u32 match u32  0 0 action mirred egress redirect dev ifb0
> > >
> > > Can anyone please point me to the right set of API (if any) to do this
> > > inside C code ?
> >
> > The classifier API is documented here. There is no high level API for
> > all of it yet so you will have to construct the Netlink message
> > yourself or add the missing pieces to libnl.
> >
> > http://www.infradead.org/~tgr/libnl/doc/api/group__cls.html
> >
> 
> Yes I saw those API and realized that I would have to construct the
> relevant netlink messages
> by hand. The protocol for bringing up/down an interface for example is
> well documented/at least well known.
> However, I couldnt find information on types of parameters/structs
> that should go into the netlink
> message for enabling egress redirect etc.
> 
> Should I be looking at "tc" sources and reverse engineering them
> (ltrace/strace) ?

The only method right now is by inspecting sources for tc or the
kernel.



More information about the libnl mailing list