For P2P links, the destination address should be configured as
the peer. If so, perhaps this works?

Index: packet.c
===================================================================
RCS file: /cvs/src/usr.sbin/ripd/packet.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 packet.c
--- packet.c    25 Oct 2014 03:23:49 -0000      1.12
+++ packet.c    6 Dec 2016 01:34:09 -0000
@@ -233,15 +233,13 @@ find_iface(struct ripd_conf *xconf, unsi
        /* 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 &
-                   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);
+                   !iface->passive) {
+                       if ((iface->addr.s_addr & iface->mask.s_addr) == 
+                           (src.s_addr & iface->mask.s_addr))
+                               return (iface);
+                       if (iface->dst.s_addr == src.s_addr)
+                               return (iface);
+               }
        }
 
        return (NULL);

Reply via email to