Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Lookup caches from a CARP interface if the packe...



details:   https://anonhg.NetBSD.org/src/rev/9f19be6f36bb
branches:  trunk
changeset: 823993:9f19be6f36bb
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Thu May 18 06:33:11 2017 +0000

description:
Lookup caches from a CARP interface if the packet is routed to the interface

This fixes CARP setups without carpdev (physical interface) having any IPs.

diffstat:

 sys/netinet/if_arp.c |  24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diffs (74 lines):

diff -r 88801244400b -r 9f19be6f36bb sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Thu May 18 02:21:05 2017 +0000
+++ b/sys/netinet/if_arp.c      Thu May 18 06:33:11 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.249 2017/05/12 17:53:53 ryo Exp $ */
+/*     $NetBSD: if_arp.c,v 1.250 2017/05/18 06:33:11 ozaki-r Exp $     */
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.249 2017/05/12 17:53:53 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.250 2017/05/18 06:33:11 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -720,6 +720,11 @@
        const char *create_lookup;
        bool renew;
        int error;
+       struct ifnet *origifp = ifp;
+#if NCARP > 0
+       if (rt != NULL && rt->rt_ifp->if_type == IFT_CARP)
+               ifp = rt->rt_ifp;
+#endif
 
        KASSERT(m != NULL);
 
@@ -796,12 +801,8 @@
 
                if (renew) {
                        const u_int8_t *enaddr =
-#if NCARP > 0
-                           (ifp->if_type == IFT_CARP) ?
-                           CLLADDR(ifp->if_sadl):
-#endif
                            CLLADDR(ifp->if_sadl);
-                       arprequest(ifp,
+                       arprequest(origifp,
                            &satocsin(rt->rt_ifa->ifa_addr)->sin_addr,
                            &satocsin(dst)->sin_addr, enaddr);
                }
@@ -861,10 +862,6 @@
 
        if (renew) {
                const u_int8_t *enaddr =
-#if NCARP > 0
-                   (rt != NULL && rt->rt_ifp->if_type == IFT_CARP) ?
-                   CLLADDR(rt->rt_ifp->if_sadl):
-#endif
                    CLLADDR(ifp->if_sadl);
                la->la_expire = time_uptime;
                arp_settimer(la, arpt_down);
@@ -872,7 +869,8 @@
                LLE_WUNLOCK(la);
 
                if (rt != NULL) {
-                       arprequest(ifp, &satocsin(rt->rt_ifa->ifa_addr)->sin_addr,
+                       arprequest(origifp,
+                           &satocsin(rt->rt_ifa->ifa_addr)->sin_addr,
                            &satocsin(dst)->sin_addr, enaddr);
                } else {
                        struct sockaddr_in sin;
@@ -884,7 +882,7 @@
                        _rt = rtalloc1((struct sockaddr *)&sin, 0);
                        if (_rt == NULL)
                                goto bad;
-                       arprequest(ifp,
+                       arprequest(origifp,
                            &satocsin(_rt->rt_ifa->ifa_addr)->sin_addr,
                            &satocsin(dst)->sin_addr, enaddr);
                        rt_unref(_rt);



Home | Main Index | Thread Index | Old Index