Piotr Durlej [pi...@durlej.net] wrote:
> 
> And here is a patch:
> 

Whoops, I missed this part...And unlike mine it is correct, as there may
not be a destination configured. I think this is the right way to go.

> diff --git a/usr.sbin/ripd/packet.c b/usr.sbin/ripd/packet.c
> index 37b4a91..b956ec0 100644
> --- a/usr.sbin/ripd/packet.c
> +++ b/usr.sbin/ripd/packet.c
> @@ -232,15 +232,17 @@ find_iface(struct ripd_conf *xconf, unsigned int
> ifindex, struct in_addr src)
> 
>      /* returned interface needs to be active */
>      LIST_FOREACH(iface, &xconf->iface_list, entry) {
> -        if (ifindex != 0 && ifindex == iface->ifindex &&
> -            !iface->passive && (iface->addr.s_addr &
> +        if (ifindex == 0 || ifindex != iface->ifindex)
> +            continue;
> +
> +        if (iface->passive)
> +            continue;
> +
> +        if ((iface->addr.s_addr &
>              iface->mask.s_addr) == (src.s_addr & iface->mask.s_addr))
> -            /*
> -             * XXX may fail on P2P links because src and dst don't
> -             * have to share a common subnet on the otherhand
> -             * checking something like this will help to support
> -             * multiple networks configured on one interface.
> -             */
> +            return (iface);
> +
> +        if (iface->dst.s_addr && iface->dst.s_addr == src.s_addr)
>              return (iface);
>      }
> 

Reply via email to