Hi,

route(8) sourceaddr is not used with p2p interfaces.
My initial fear was about tunnel interfaces but after some more testing, there
is no need to be so.

Here is the diff:

Index: sbin/route/route.8
===================================================================
RCS file: /cvs/src/sbin/route/route.8,v
retrieving revision 1.93
diff -u -p -r1.93 route.8
--- sbin/route/route.8  30 Oct 2020 14:30:51 -0000      1.93
+++ sbin/route/route.8  2 Nov 2020 19:53:34 -0000
@@ -234,8 +234,6 @@ The preferred source will not be used wh
 .It
 destination is on-link
 .It
-output interface is point-to-point
-.It
 source address is assigned to a disabled interface
 .El
 .El
Index: sys/netinet/in_pcb.c
===================================================================
RCS file: /cvs/src/sys/netinet/in_pcb.c,v
retrieving revision 1.250
diff -u -p -r1.250 in_pcb.c
--- sys/netinet/in_pcb.c        29 Oct 2020 21:15:27 -0000      1.250
+++ sys/netinet/in_pcb.c        2 Nov 2020 19:53:36 -0000
@@ -960,12 +960,10 @@ in_pcbselsrc(struct in_addr **insrc, str
        /*
         * Use preferred source address if :
         * - destination is not onlink
-        * - output interface is not PtoP
         * - preferred source addresss is set
         * - output interface is UP
         */
-       if ((ro->ro_rt && !(ro->ro_rt->rt_flags & RTF_LLINFO)) &&
-           (ia && !(ia->ia_ifp->if_flags & IFF_POINTOPOINT))) {
+       if (ro->ro_rt && !(ro->ro_rt->rt_flags & RTF_LLINFO)) {
                ip4_source = rtable_getsource(rtableid, AF_INET);
                if (ip4_source != NULL) {
                        struct ifaddr *ifa;
Index: sys/netinet6/in6_src.c
===================================================================
RCS file: /cvs/src/sys/netinet6/in6_src.c,v
retrieving revision 1.82
diff -u -p -r1.82 in6_src.c
--- sys/netinet6/in6_src.c      29 Oct 2020 21:15:27 -0000      1.82
+++ sys/netinet6/in6_src.c      2 Nov 2020 19:53:36 -0000
@@ -220,12 +220,10 @@ in6_pcbselsrc(struct in6_addr **in6src, 
        /*
         * Use preferred source address if :
         * - destination is not onlink
-        * - output interface is not PtoP
         * - preferred source addresss is set
         * - output interface is UP
         */
-       if ((ro->ro_rt && !(ro->ro_rt->rt_flags & RTF_LLINFO)) &&
-           (ia6 && !(ia6->ia_ifp->if_flags & IFF_POINTOPOINT))) {
+       if (ro->ro_rt && !(ro->ro_rt->rt_flags & RTF_LLINFO)) {
                ip6_source = rtable_getsource(rtableid, AF_INET6);
                if (ip6_source != NULL) {
                        struct ifaddr *ifa;

Reply via email to