diff options
author | 2015-08-19 11:05:33 +0000 | |
---|---|---|
committer | 2015-08-19 11:05:33 +0000 | |
commit | 25e44a866e097391125b15f1c0466e022c8a9c0c (patch) | |
tree | e077f8a2f66f6a734e3c04c6484e44a6c5b9648e /sys | |
parent | Make arplookup() return a pointer to a "struct rtentry". (diff) | |
download | wireguard-openbsd-25e44a866e097391125b15f1c0466e022c8a9c0c.tar.xz wireguard-openbsd-25e44a866e097391125b15f1c0466e022c8a9c0c.zip |
KNF
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/if_ether.c | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 335276db4ca..c4a997eb2ef 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.161 2015/08/19 10:50:14 mpi Exp $ */ +/* $OpenBSD: if_ether.c,v 1.162 2015/08/19 11:05:33 mpi Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -638,42 +638,43 @@ in_arpinput(struct mbuf *m) if (rt != NULL && (sdl = SDL(rt->rt_gateway)) != NULL) { la = (struct llinfo_arp *)rt->rt_llinfo; if (sdl->sdl_alen) { - if (memcmp(ea->arp_sha, LLADDR(sdl), sdl->sdl_alen)) { - if (rt->rt_flags & - (RTF_PERMANENT_ARP|RTF_LOCAL)) { - inet_ntop(AF_INET, &isaddr, addr, sizeof(addr)); - log(LOG_WARNING, - "arp: attempt to overwrite permanent " - "entry for %s by %s on %s\n", addr, - ether_sprintf(ea->arp_sha), - ifp->if_xname); - goto out; - } else if (rt->rt_ifp != ifp) { + if (memcmp(ea->arp_sha, LLADDR(sdl), sdl->sdl_alen)) { + if (rt->rt_flags & + (RTF_PERMANENT_ARP|RTF_LOCAL)) { + inet_ntop(AF_INET, &isaddr, addr, + sizeof(addr)); + log(LOG_WARNING, "arp: attempt to" + " overwrite permanent entry for %s" + " by %s on %s\n", addr, + ether_sprintf(ea->arp_sha), + ifp->if_xname); + goto out; + } else if (rt->rt_ifp != ifp) { #if NCARP > 0 - if (ifp->if_type != IFT_CARP) + if (ifp->if_type != IFT_CARP) #endif - { - inet_ntop(AF_INET, &isaddr, - addr, sizeof(addr)); - log(LOG_WARNING, - "arp: attempt to overwrite entry for" - " %s on %s by %s on %s\n", addr, - rt->rt_ifp->if_xname, + { + inet_ntop(AF_INET, &isaddr, + addr, sizeof(addr)); + log(LOG_WARNING, "arp: attempt" + " to overwrite entry for" + " %s on %s by %s on %s\n", + addr, rt->rt_ifp->if_xname, + ether_sprintf(ea->arp_sha), + ifp->if_xname); + } + goto out; + } else { + inet_ntop(AF_INET, &isaddr, addr, + sizeof(addr)); + log(LOG_INFO, "arp info overwritten for" + " %s by %s on %s\n", addr, ether_sprintf(ea->arp_sha), ifp->if_xname); + rt->rt_expire = 1;/* no longer static */ } - goto out; - } else { - inet_ntop(AF_INET, &isaddr, addr, sizeof(addr)); - log(LOG_INFO, - "arp info overwritten for %s by %s on %s\n", - addr, - ether_sprintf(ea->arp_sha), - ifp->if_xname); - rt->rt_expire = 1; /* no longer static */ - } changed = 1; - } + } } else if (rt->rt_ifp != ifp && #if NBRIDGE > 0 !SAME_BRIDGE(ifp->if_bridgeport, |