Hi Donald,

Thanks for the quick reply! I knew that question was inbound - basically
building a router-as-a-service proof of concept and wanted to hide the
management interface and route from vty - (it'll still be there as far as
routing is concerned, but if it's not seen that's fine).

Thanks for that - I just worked that one out but was just (in_addr *) and
was just about to write the test using inet_pton(). How would you build the
test var in code, i.e to set <ipv4 address...>, would it be best to use
inet_pton() to take a string and compare?

Cheers,
AT

On Thu, Jan 7, 2016 at 1:20 PM, Donald Sharp <[email protected]>
wrote:

> 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