Module Name:    src
Committed By:   ozaki-r
Date:           Wed Jul  1 03:39:36 UTC 2015

Modified Files:
        src/sys/net: if_tokensubr.c
        src/sys/netinet: ip_output.c

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/net/if_tokensubr.c
cvs rdiff -u -r1.241 -r1.242 src/sys/netinet/ip_output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_tokensubr.c
diff -u src/sys/net/if_tokensubr.c:1.68 src/sys/net/if_tokensubr.c:1.69
--- src/sys/net/if_tokensubr.c:1.68	Mon May 25 08:31:34 2015
+++ src/sys/net/if_tokensubr.c	Wed Jul  1 03:39:36 2015
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: if_tokensubr
 
 #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 void	token_input(struct ifnet *, 
  */
 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 @@ token_output(struct ifnet *ifp0, struct 
 		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 @@ token_output(struct ifnet *ifp0, struct 
 
 	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 @@ token_output(struct ifnet *ifp0, struct 
  * 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 @@ token_output(struct ifnet *ifp0, struct 
 		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)

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.241 src/sys/netinet/ip_output.c:1.242
--- src/sys/netinet/ip_output.c:1.241	Mon Jun  8 08:19:20 2015
+++ src/sys/netinet/ip_output.c	Wed Jul  1 03:39:36 2015
@@ -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 @@ ip_hresolv_needed(const struct ifnet * c
 	case IFT_FDDI:
 	case IFT_HIPPI:
 	case IFT_IEEE1394:
+	case IFT_ISO88025:
 		return true;
 	default:
 		return false;

Reply via email to