If you do not specify an ifindex this happens in rib_add_ipv4:
  /* Nexthop settings. */
  if (gate)
    {
      if (ifindex)
        nexthop_ipv4_ifindex_add (rib, gate, src, ifindex);
      else
        nexthop_ipv4_add (rib, gate, src);
    }
  else
    nexthop_ifindex_add (rib, ifindex);


So what is happening is that rib_add_ipv4 is noticing that we haven't
received an ifindex from the caller and adds a gateway via
nexthop_ipv4_add, which does the lookup for the outgoing interface.

Does it matter?  I don't think it does.  The outgoing interface received in
kernel_socket.c is specified as a char *.  Which would need to be
translated into an interface pointer.

So the code has a choice of converting the interface char * into a ifp or
turning the ip address of the nexthop into a ifp.  Not sure that it matters.

donald

On Thu, Mar 10, 2016 at 6:03 PM, Jafar Al-Gharaibeh <[email protected]>
wrote:

> The following functions:
>
> rib_add_ipv[4/6]
> rib_delete_ipv[4/6]
>
> expect an interface index as one of the arguments, which seems to be the
> case
> everywhere they are used in the code except in zebra/kernel_socket.c.
> For the ipv4 family the value 0 is passed for the index, whereas
> for the ipv6,  one place passes 0 and two other places pass a variable
> called ifindex
> that is only initialized to non-zero under an ifdef.
>
> Is that how it should be? Does ifindex have any significance in these
> cases ?
>
> Thanks,
> Jafar
>
>
> _______________________________________________
> 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