Source-Changes-HG archive

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

[src/trunk]: src/sys/net Make the arpresolve branch more readable, fix typo, ...



details:   https://anonhg.NetBSD.org/src/rev/9da14d0c8a07
branches:  trunk
changeset: 829819:9da14d0c8a07
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Feb 13 15:21:59 2018 +0000

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

diffstat:

 sys/net/if_ethersubr.c |  23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diffs (81 lines):

diff -r 88d640514b4d -r 9da14d0c8a07 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c    Tue Feb 13 14:50:28 2018 +0000
+++ b/sys/net/if_ethersubr.c    Tue Feb 13 15:21:59 2018 +0000
@@ -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 @@
        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 @@
                    (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 @@
                        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 @@
 
                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 @@
                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 @@
 
                        M_PREPEND(m, sizeof(struct llc), M_DONTWAIT);
                        if (m == NULL) {
+                               pserialize_read_exit(s);
                                KERNEL_UNLOCK_ONE(NULL);
                                senderr(ENOBUFS);
                        }



Home | Main Index | Thread Index | Old Index