Source-Changes-HG archive

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

[src/trunk]: src/sys Use ip_hresolv_output for if_token as well



details:   https://anonhg.NetBSD.org/src/rev/3b2987c115a2
branches:  trunk
changeset: 339166:3b2987c115a2
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jul 01 03:39:36 2015 +0000

description:
Use ip_hresolv_output for if_token as well

I thought we cannot apply ip_hresolv_output to if_token because
rt0 looked being needed by arpresolve in token_output. However,
rt0 is actually not used by arpresolve in NetBSD (see obsolete
ARPRESOLVE macro).

diffstat:

 sys/net/if_tokensubr.c  |  45 ++++++---------------------------------------
 sys/netinet/ip_output.c |   5 +++--
 2 files changed, 9 insertions(+), 41 deletions(-)

diffs (132 lines):

diff -r 844a032db1f7 -r 3b2987c115a2 sys/net/if_tokensubr.c
--- a/sys/net/if_tokensubr.c    Tue Jun 30 22:16:12 2015 +0000
+++ b/sys/net/if_tokensubr.c    Wed Jul 01 03:39:36 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_tokensubr.c,v 1.68 2015/05/25 08:31:34 ozaki-r Exp $        */
+/*     $NetBSD: if_tokensubr.c,v 1.69 2015/07/01 03:39:36 ozaki-r Exp $        */
 
 /*
  * Copyright (c) 1982, 1989, 1993
@@ -92,7 +92,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tokensubr.c,v 1.68 2015/05/25 08:31:34 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tokensubr.c,v 1.69 2015/07/01 03:39:36 ozaki-r Exp $");
 
 #include "opt_inet.h"
 #include "opt_atalk.h"
@@ -137,16 +137,6 @@
 
 #define senderr(e) { error = (e); goto bad;}
 
-#if defined(__bsdi__) || defined(__NetBSD__)
-#define        RTALLOC1(a, b)                  rtalloc1(a, b)
-#define        ARPRESOLVE(a, b, c, d, e, f)    arpresolve(a, b, c, d, e)
-#define        TYPEHTONS(t)                    (t)
-#elif defined(__FreeBSD__)
-#define        RTALLOC1(a, b)                  rtalloc1(a, b, 0UL)
-#define        ARPRESOLVE(a, b, c, d, e, f)    arpresolve(a, b, c, d, e, f)
-#define        TYPEHTONS(t)                    (htons(t))
-#endif
-
 #define RCF_ALLROUTES (2 << 8) | TOKEN_RCF_FRAME2 | TOKEN_RCF_BROADCAST_ALL
 #define RCF_SINGLEROUTE (2 << 8) | TOKEN_RCF_FRAME2 | TOKEN_RCF_BROADCAST_SINGLE
 
@@ -162,13 +152,12 @@
  */
 static int
 token_output(struct ifnet *ifp0, struct mbuf *m0, const struct sockaddr *dst,
-    struct rtentry *rt0)
+    struct rtentry *rt)
 {
        uint16_t etype;
        int error = 0;
        u_char edst[ISO88025_ADDR_LEN];
        struct mbuf *m = m0;
-       struct rtentry *rt;
        struct mbuf *mcopy = NULL;
        struct token_header *trh;
 #ifdef INET
@@ -188,7 +177,7 @@
                if (dst != NULL && ifp0->if_link_state == LINK_STATE_UP &&
                    (ifa = ifa_ifwithaddr(dst)) != NULL &&
                    ifa->ifa_ifp == ifp0)
-                       return (looutput(ifp0, m, dst, rt0));
+                       return (looutput(ifp0, m, dst, rt));
 
                ifp = ifp->if_carpdev;
                ah = (struct arphdr *)ifp;
@@ -201,28 +190,6 @@
 
        if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
                senderr(ENETDOWN);
-       if ((rt = rt0)) {
-               if ((rt->rt_flags & RTF_UP) == 0) {
-                       if ((rt0 = rt = RTALLOC1(dst, 1)))
-                               rt->rt_refcnt--;
-                       else
-                               senderr(EHOSTUNREACH);
-               }
-               if (rt->rt_flags & RTF_GATEWAY) {
-                       if (rt->rt_gwroute == 0)
-                               goto lookup;
-                       if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) {
-                               rtfree(rt); rt = rt0;
-                       lookup: rt->rt_gwroute = RTALLOC1(rt->rt_gateway, 1);
-                               if ((rt = rt->rt_gwroute) == 0)
-                                       senderr(EHOSTUNREACH);
-                       }
-               }
-               if (rt->rt_flags & RTF_REJECT)
-                       if (rt->rt_rmx.rmx_expire == 0 ||
-                           time_second < rt->rt_rmx.rmx_expire)
-                               senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH);
-       }
 
        /*
         * If the queueing discipline needs packet classification,
@@ -249,7 +216,7 @@
  * XXX m->m_flags & M_MCAST   IEEE802_MAP_IP_MULTICAST ??
  */
                else {
-                       if (!ARPRESOLVE(ifp, rt, m, dst, edst, rt0))
+                       if (!arpresolve(ifp, rt, m, dst, edst))
                                return (0);     /* if not yet resolved */
                        rif = TOKEN_RIF((struct llinfo_arp *) rt->rt_llinfo);
                        riflen = (ntohs(rif->tr_rcf) & TOKEN_RCF_LEN_MASK) >> 8;
@@ -327,7 +294,7 @@
                memcpy(edst, eh->ether_dhost, sizeof(edst));
                if (*edst & 1)
                        m->m_flags |= (M_BCAST|M_MCAST);
-               etype = TYPEHTONS(eh->ether_type);
+               etype = eh->ether_type;
                if (m->m_flags & M_BCAST) {
                        if (ifp->if_flags & IFF_LINK0) {
                                if (ifp->if_flags & IFF_LINK1)
diff -r 844a032db1f7 -r 3b2987c115a2 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Tue Jun 30 22:16:12 2015 +0000
+++ b/sys/netinet/ip_output.c   Wed Jul 01 03:39:36 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.241 2015/06/08 08:19:20 roy Exp $      */
+/*     $NetBSD: ip_output.c,v 1.242 2015/07/01 03:39:36 ozaki-r Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.241 2015/06/08 08:19:20 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.242 2015/07/01 03:39:36 ozaki-r Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -166,6 +166,7 @@
        case IFT_FDDI:
        case IFT_HIPPI:
        case IFT_IEEE1394:
+       case IFT_ISO88025:
                return true;
        default:
                return false;



Home | Main Index | Thread Index | Old Index