I'm curious.  What's your specific reasoning for wanting to do this?

All incoming routes from the linux kernel in rt_netlink.c eventually call
rib_add_ipv[4|6] or rib_add_ipv4_multipath.

gate is assigned on lines 729 and 932 of rt_netlink.c.

An ipv4 address is stored as a struct in_addr.  gate in rt_netlink.c is
just a void pointer and rib_add_ipv4 takes a struct in_addr *,
So just do something like this:

struct in_addr *foo;

foo = (struct in_addr *)gate;

if (*foo == <ipv4 address you are interested in>)
  return;


donald

On Wed, Jan 6, 2016 at 8:46 PM, Alexander Turner <[email protected]>
wrote:

> Hi all,
>
> I'm trying to modify source to hide certain interfaces and routes from the
> vty shell. Namely any interface containing "eth" and a specific route.
>
> I'm not trying to remove these from netlink, I just don't want them to
> appear in vtysh.
>
> I've achieved the former by modifying netlink_interface() in
> zebra/rt_netlink.c to perform a string comparison test against ifp->name
> which is working perfectly.
>
> I'm now on to the latter in which I'm trying to hide a specific route
> which can be achieved by preventing zebra from learning about any routes
> with the gateway X.X.X.X for example.
>
> I imagine the relevant code is hiding within netlink_routing_table() in
> zebra/rt_netlink.c though I can't seem to see what type gate is and how
> to match against it with an IPv4 address (or even if it's the right var).
>
> Any pointers would be greatly appreciated.
>
> Thanks!
> Alex Turner
>
> _______________________________________________
> Quagga-dev mailing list
> [email protected]
> https://lists.quagga.net/mailman/listinfo/quagga-dev
>
_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to