Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Constify rtentry of arpresolve



details:   https://anonhg.NetBSD.org/src/rev/402a2c88ac11
branches:  trunk
changeset: 344771:402a2c88ac11
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Apr 19 04:13:56 2016 +0000

description:
Constify rtentry of arpresolve

We don't need to (rather shouldn't) modify rtentry in there.

diffstat:

 sys/netinet/if_arp.c   |  29 +++++++++--------------------
 sys/netinet/if_inarp.h |   4 ++--
 2 files changed, 11 insertions(+), 22 deletions(-)

diffs (88 lines):

diff -r 3dac6cd29c94 -r 402a2c88ac11 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Tue Apr 19 02:52:29 2016 +0000
+++ b/sys/netinet/if_arp.c      Tue Apr 19 04:13:56 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.207 2016/04/18 02:24:42 ozaki-r Exp $     */
+/*     $NetBSD: if_arp.c,v 1.208 2016/04/19 04:13:56 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.207 2016/04/18 02:24:42 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.208 2016/04/19 04:13:56 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -685,7 +685,7 @@
  * Any other value indicates an error.
  */
 int
-arpresolve(struct ifnet *ifp, struct rtentry *rt, struct mbuf *m,
+arpresolve(struct ifnet *ifp, const struct rtentry *rt, struct mbuf *m,
     const struct sockaddr *dst, void *desten, size_t destlen)
 {
        struct llentry *la;
@@ -707,18 +707,6 @@
                return 0;
        }
 
-       /*
-        * Re-send the ARP request when appropriate.
-        */
-#ifdef DIAGNOSTIC
-       if (rt->rt_expire == 0) {
-               /* This should never happen. (Should it? -gwr) */
-               printf("%s: unresolved and rt_expire == 0\n", __func__);
-               /* Set expiration time to now (expired). */
-               rt->rt_expire = time_uptime;
-       }
-#endif
-
 notfound:
 #ifdef IFF_STATICARP /* FreeBSD */
 #define _IFF_NOARP (IFF_NOARP | IFF_STATICARP)
@@ -859,17 +847,18 @@
                            &satocsin(dst)->sin_addr, enaddr);
                } else {
                        struct sockaddr_in sin;
+                       struct rtentry *_rt;
 
                        sockaddr_in_init(&sin, &la->r_l3addr.addr4, 0);
 
                        /* XXX */
-                       rt = rtalloc1((struct sockaddr *)&sin, 0);
-                       if (rt == NULL)
+                       _rt = rtalloc1((struct sockaddr *)&sin, 0);
+                       if (_rt == NULL)
                                goto bad;
-                       arprequest(ifp, &satocsin(rt->rt_ifa->ifa_addr)->sin_addr,
+                       arprequest(ifp,
+                           &satocsin(_rt->rt_ifa->ifa_addr)->sin_addr,
                            &satocsin(dst)->sin_addr, enaddr);
-                       rtfree(rt);
-                       rt = NULL;
+                       rtfree(_rt);
                }
                return error;
        }
diff -r 3dac6cd29c94 -r 402a2c88ac11 sys/netinet/if_inarp.h
--- a/sys/netinet/if_inarp.h    Tue Apr 19 02:52:29 2016 +0000
+++ b/sys/netinet/if_inarp.h    Tue Apr 19 04:13:56 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_inarp.h,v 1.48 2016/04/07 03:22:15 christos Exp $   */
+/*     $NetBSD: if_inarp.h,v 1.49 2016/04/19 04:13:56 ozaki-r Exp $    */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -75,7 +75,7 @@
 extern struct ifqueue arpintrq;
 void arp_ifinit(struct ifnet *, struct ifaddr *);
 void arp_rtrequest(int, struct rtentry *, const struct rt_addrinfo *);
-int arpresolve(struct ifnet *, struct rtentry *, struct mbuf *,
+int arpresolve(struct ifnet *, const struct rtentry *, struct mbuf *,
     const struct sockaddr *, void *, size_t);
 void arpintr(void);
 void arprequest(struct ifnet *, const struct in_addr *, const struct in_addr *,



Home | Main Index | Thread Index | Old Index