Module Name: src Committed By: bouyer Date: Sat Sep 5 11:44:07 UTC 2009
Modified Files: src/sys/netinet [netbsd-5]: if_arp.c Log Message: Pull up following revision(s) (requested by dyoung in ticket #911): sys/netinet/if_arp.c: revision 1.146 Don't require the gateway address to have room for both an interface name and address. Room for an address will do. This should fix a regression in 'arp -s ...' on interfaces such as xennet0 with unusually long names. Fix PR #41878. To generate a diff of this commit: cvs rdiff -u -r1.143 -r1.143.4.1 src/sys/netinet/if_arp.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/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.143 src/sys/netinet/if_arp.c:1.143.4.1 --- src/sys/netinet/if_arp.c:1.143 Fri Oct 24 17:07:33 2008 +++ src/sys/netinet/if_arp.c Sat Sep 5 11:44:07 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.143 2008/10/24 17:07:33 dyoung Exp $ */ +/* $NetBSD: if_arp.c,v 1.143.4.1 2009/09/05 11:44:07 bouyer Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.143 2008/10/24 17:07:33 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.143.4.1 2009/09/05 11:44:07 bouyer Exp $"); #include "opt_ddb.h" #include "opt_inet.h" @@ -459,8 +459,6 @@ struct in_ifaddr *ia; struct ifaddr *ifa; struct ifnet *ifp = rt->rt_ifp; - uint8_t namelen = strlen(ifp->if_xname); - uint8_t addrlen = ifp->if_addrlen; if (!arpinit_done) { arpinit_done = 1; @@ -567,7 +565,7 @@ /*FALLTHROUGH*/ case RTM_RESOLVE: if (gate->sa_family != AF_LINK || - gate->sa_len < sockaddr_dl_measure(namelen, addrlen)) { + gate->sa_len < sockaddr_dl_measure(0, ifp->if_addrlen)) { log(LOG_DEBUG, "arp_rtrequest: bad gateway value\n"); break; } @@ -579,7 +577,7 @@ * Case 2: This route may come from cloning, or a manual route * add with a LL address. */ - switch (satocsdl(gate)->sdl_type) { + switch (ifp->if_type) { #if NTOKEN > 0 case IFT_ISO88025: allocsize = sizeof(*la) + sizeof(struct token_rif); @@ -622,8 +620,12 @@ * interface. */ rt->rt_expire = 0; - (void)sockaddr_dl_setaddr(satosdl(gate), gate->sa_len, - CLLADDR(ifp->if_sadl), ifp->if_addrlen); + if (sockaddr_dl_init(satosdl(gate), gate->sa_len, + ifp->if_index, ifp->if_type, NULL, 0, + CLLADDR(ifp->if_sadl), ifp->if_addrlen) == NULL) { + panic("%s(%s): sockaddr_dl_init cannot fail", + __func__, ifp->if_xname); + } if (useloopback) ifp = rt->rt_ifp = lo0ifp; /*