Module Name:    src
Committed By:   maxv
Date:           Tue Feb 13 15:21:59 UTC 2018

Modified Files:
        src/sys/net: if_ethersubr.c

Log Message:
Make the arpresolve branch more readable, fix typo, fix XXX (which I
added), add missing pserialize_read_exit (which I forgot).


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 src/sys/net/if_ethersubr.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_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.259 src/sys/net/if_ethersubr.c:1.260
--- src/sys/net/if_ethersubr.c:1.259	Tue Feb 13 10:50:38 2018
+++ src/sys/net/if_ethersubr.c	Tue Feb 13 15:21:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.259 2018/02/13 10:50:38 maxv Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.260 2018/02/13 15:21:59 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.259 2018/02/13 10:50:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.260 2018/02/13 15:21:59 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -198,10 +198,10 @@ ether_output(struct ifnet * const ifp0, 
 	struct ifnet *ifp = ifp0;
 #ifdef INET
 	struct arphdr *ah;
-#endif /* INET */
+#endif
 #ifdef NETATALK
 	struct at_ifaddr *aa;
-#endif /* NETATALK */
+#endif
 
 #ifdef MBUFTRACE
 	m_claimm(m, ifp->if_mowner);
@@ -229,7 +229,7 @@ ether_output(struct ifnet * const ifp0, 
 		    (IFF_UP | IFF_RUNNING))
 			senderr(ENETDOWN);
 	}
-#endif /* NCARP > 0 */
+#endif
 
 	if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) != (IFF_UP | IFF_RUNNING))
 		senderr(ENETDOWN);
@@ -242,9 +242,10 @@ ether_output(struct ifnet * const ifp0, 
 			memcpy(edst, etherbroadcastaddr, sizeof(edst));
 		else if (m->m_flags & M_MCAST)
 			ETHER_MAP_IP_MULTICAST(&satocsin(dst)->sin_addr, edst);
-		else if ((error = arpresolve(ifp, rt, m, dst, edst,
-		    sizeof(edst))) != 0) {
-			return error == EWOULDBLOCK ? 0 : error;
+		else {
+			error = arpresolve(ifp, rt, m, dst, edst, sizeof(edst));
+			if (error)
+				return (error == EWOULDBLOCK) ? 0 : error;
 		}
 		/* If broadcasting on a simplex interface, loopback a copy */
 		if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX))
@@ -309,7 +310,7 @@ ether_output(struct ifnet * const ifp0, 
 
 		if (!aarpresolve(ifp, m, (const struct sockaddr_at *)dst, edst)) {
 #ifdef NETATALKDEBUG
-			printf("aarpresolv failed\n");
+			printf("aarpresolve failed\n");
 #endif
 			KERNEL_UNLOCK_ONE(NULL);
 			return (0);
@@ -323,8 +324,7 @@ ether_output(struct ifnet * const ifp0, 
 		if (ifa == NULL) {
 			pserialize_read_exit(s);
 			KERNEL_UNLOCK_ONE(NULL);
-			/* XXX error? */
-			goto bad;
+			senderr(EADDRNOTAVAIL);
 		}
 		aa = (struct at_ifaddr *)ifa;
 
@@ -339,6 +339,7 @@ ether_output(struct ifnet * const ifp0, 
 
 			M_PREPEND(m, sizeof(struct llc), M_DONTWAIT);
 			if (m == NULL) {
+				pserialize_read_exit(s);
 				KERNEL_UNLOCK_ONE(NULL);
 				senderr(ENOBUFS);
 			}

Reply via email to