Date: Fri, 12 Jan 2007 22:35:19 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 112839 for review Message-ID: <200701122235.l0CMZJ2s007930@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=112839 Change 112839 by jhb@jhb_zion on 2007/01/12 22:34:28 IFC @112838. Affected files ... .. //depot/projects/smpng/sys/amd64/include/setjmp.h#3 integrate .. //depot/projects/smpng/sys/dev/mii/amphy.c#15 integrate .. //depot/projects/smpng/sys/dev/mii/exphy.c#14 integrate .. //depot/projects/smpng/sys/dev/mii/inphy.c#10 integrate .. //depot/projects/smpng/sys/dev/mii/lxtphy.c#16 integrate .. //depot/projects/smpng/sys/dev/mii/nsphy.c#15 integrate .. //depot/projects/smpng/sys/dev/mii/rlphy.c#19 integrate .. //depot/projects/smpng/sys/dev/pci/pci.c#83 integrate .. //depot/projects/smpng/sys/i386/include/setjmp.h#3 integrate .. //depot/projects/smpng/sys/ia64/include/exec.h#4 integrate .. //depot/projects/smpng/sys/ia64/include/floatingpoint.h#3 integrate .. //depot/projects/smpng/sys/ia64/include/reloc.h#3 integrate .. //depot/projects/smpng/sys/kern/kern_acl.c#28 integrate .. //depot/projects/smpng/sys/kern/kern_ntptime.c#20 integrate .. //depot/projects/smpng/sys/netatalk/aarp.c#22 integrate .. //depot/projects/smpng/sys/netatalk/aarp.h#3 integrate .. //depot/projects/smpng/sys/netatalk/at.h#4 integrate .. //depot/projects/smpng/sys/netatalk/at_extern.h#8 integrate .. //depot/projects/smpng/sys/netatalk/at_proto.c#5 integrate .. //depot/projects/smpng/sys/netatalk/at_rmx.c#5 integrate .. //depot/projects/smpng/sys/netatalk/at_var.h#6 integrate .. //depot/projects/smpng/sys/netatalk/ddp.h#3 integrate .. //depot/projects/smpng/sys/netatalk/ddp_input.c#17 integrate .. //depot/projects/smpng/sys/netatalk/ddp_output.c#13 integrate .. //depot/projects/smpng/sys/netatalk/ddp_pcb.c#11 integrate .. //depot/projects/smpng/sys/netatalk/ddp_pcb.h#5 integrate .. //depot/projects/smpng/sys/netatalk/ddp_usrreq.c#29 integrate .. //depot/projects/smpng/sys/netatalk/ddp_var.h#5 integrate .. //depot/projects/smpng/sys/netinet/ip.h#12 integrate .. //depot/projects/smpng/sys/netinet6/esp_aesctr.c#5 integrate .. //depot/projects/smpng/sys/netinet6/in6_cksum.c#12 integrate .. //depot/projects/smpng/sys/powerpc/include/reloc.h#3 integrate .. //depot/projects/smpng/sys/sparc64/include/reloc.h#3 integrate .. //depot/projects/smpng/sys/sparc64/include/setjmp.h#7 integrate .. //depot/projects/smpng/sys/sun4v/include/reloc.h#2 integrate .. //depot/projects/smpng/sys/sun4v/include/setjmp.h#2 integrate Differences ... ==== //depot/projects/smpng/sys/amd64/include/setjmp.h#3 (text+ko) ==== @@ -10,10 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors + * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -29,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/include/setjmp.h,v 1.9 2003/06/02 21:49:35 peter Exp $ + * $FreeBSD: src/sys/amd64/include/setjmp.h,v 1.10 2007/01/12 07:24:06 imp Exp $ */ #ifndef _MACHINE_SETJMP_H_ ==== //depot/projects/smpng/sys/dev/mii/amphy.c#15 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mii/amphy.c,v 1.21 2006/12/02 21:21:16 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mii/amphy.c,v 1.22 2007/01/12 22:27:46 marius Exp $"); /* * driver for AMD AM79c873 PHYs @@ -120,7 +120,7 @@ #if 0 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), - BMCR_LOOP|BMCR_S100); + MII_MEDIA_100_TX); #endif mii_phy_reset(sc); ==== //depot/projects/smpng/sys/dev/mii/exphy.c#14 (text+ko) ==== @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mii/exphy.c,v 1.21 2006/07/03 02:53:39 yongari Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mii/exphy.c,v 1.22 2007/01/12 22:27:46 marius Exp $"); /* * driver for 3Com internal PHYs @@ -185,7 +185,7 @@ #endif ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), - BMCR_LOOP|BMCR_S100); + MII_MEDIA_100_TX); exphy_reset(sc); ==== //depot/projects/smpng/sys/dev/mii/inphy.c#10 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mii/inphy.c,v 1.16 2006/12/02 15:32:33 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mii/inphy.c,v 1.17 2007/01/12 22:27:46 marius Exp $"); /* * driver for Intel 82553 and 82555 PHYs @@ -115,7 +115,7 @@ ifmedia_add(&mii->mii_media, IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), - BMCR_LOOP|BMCR_S100, NULL); + MII_MEDIA_100_TX, NULL); mii_phy_reset(sc); ==== //depot/projects/smpng/sys/dev/mii/lxtphy.c#16 (text+ko) ==== @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mii/lxtphy.c,v 1.18 2006/12/02 15:32:33 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mii/lxtphy.c,v 1.19 2007/01/12 22:27:46 marius Exp $"); /* * driver for Level One's LXT-970 ethernet 10/100 PHY @@ -161,10 +161,10 @@ #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, 0, sc->mii_inst), - BMCR_S100); + MII_MEDIA_100_TX); printf("100baseFX, "); ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, IFM_FDX, sc->mii_inst), - BMCR_S100|BMCR_FDX); + MII_MEDIA_100_TX_FDX); printf("100baseFX-FDX, "); #undef ADD ==== //depot/projects/smpng/sys/dev/mii/nsphy.c#15 (text+ko) ==== @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mii/nsphy.c,v 1.27 2006/12/02 15:32:33 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mii/nsphy.c,v 1.28 2007/01/12 22:27:46 marius Exp $"); /* * driver for National Semiconductor's DP83840A ethernet 10/100 PHY @@ -178,7 +178,7 @@ if (strcmp(nic, "pcn") != 0) #if 1 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, - sc->mii_inst), BMCR_LOOP|BMCR_S100); + sc->mii_inst), MII_MEDIA_100_TX); #else if (strcmp(nic, "pcn") == 0) sc->mii_flags |= MIIF_NOLOOP; ==== //depot/projects/smpng/sys/dev/mii/rlphy.c#19 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mii/rlphy.c,v 1.25 2006/12/02 15:32:33 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mii/rlphy.c,v 1.26 2007/01/12 22:27:46 marius Exp $"); /* * driver for RealTek 8139 internal PHYs @@ -153,7 +153,7 @@ #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), - BMCR_LOOP|BMCR_S100); + MII_MEDIA_100_TX); mii_phy_reset(sc); ==== //depot/projects/smpng/sys/dev/pci/pci.c#83 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.331 2006/12/28 06:14:42 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.334 2007/01/12 21:37:51 jhb Exp $"); #include "opt_bus.h" @@ -178,16 +178,21 @@ { 0x02001166, PCI_QUIRK_MAP_REG, 0x90, 0 }, /* - * MSI doesn't work with the Intel E7501 chipset, at least on - * the Tyan 2721 motherboard. + * MSI doesn't work with the ServerWorks CNB20-HE Host Bridge + * or the CMIC-SL (AKA ServerWorks GC_LE). */ - { 0x254c8086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + { 0x00141166, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + { 0x00171166, PCI_QUIRK_DISABLE_MSI, 0, 0 }, /* - * MSI doesn't work with the Intel E7505 chipset, at least on - * the Tyan S2665ANF motherboard. + * MSI doesn't work on earlier Intel chipsets including + * E7500, E7501, E7505, E7210, and 855. */ + { 0x25408086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + { 0x254c8086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, { 0x25508086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + { 0x25788086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + { 0x35808086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, { 0 } }; ==== //depot/projects/smpng/sys/i386/include/setjmp.h#3 (text+ko) ==== @@ -10,10 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors + * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -29,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/include/setjmp.h,v 1.7 2002/10/05 05:47:55 mike Exp $ + * $FreeBSD: src/sys/i386/include/setjmp.h,v 1.8 2007/01/12 07:24:35 imp Exp $ */ #ifndef _MACHINE_SETJMP_H_ ==== //depot/projects/smpng/sys/ia64/include/exec.h#4 (text+ko) ==== @@ -10,10 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors + * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -29,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/ia64/include/exec.h,v 1.3 2005/02/19 21:16:48 ru Exp $ + * $FreeBSD: src/sys/ia64/include/exec.h,v 1.4 2007/01/12 07:24:36 imp Exp $ */ #ifndef _MACHINE_EXEC_H_ ==== //depot/projects/smpng/sys/ia64/include/floatingpoint.h#3 (text+ko) ==== @@ -10,10 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors + * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -29,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/ia64/include/floatingpoint.h,v 1.2 2005/01/06 22:18:23 imp Exp $ + * $FreeBSD: src/sys/ia64/include/floatingpoint.h,v 1.3 2007/01/12 07:24:36 imp Exp $ */ #include <machine/ieeefp.h> ==== //depot/projects/smpng/sys/ia64/include/reloc.h#3 (text+ko) ==== @@ -10,10 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors + * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -29,5 +26,5 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/ia64/include/reloc.h,v 1.2 2005/01/06 22:18:23 imp Exp $ + * $FreeBSD: src/sys/ia64/include/reloc.h,v 1.3 2007/01/12 07:24:36 imp Exp $ */ ==== //depot/projects/smpng/sys/kern/kern_acl.c#28 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_acl.c,v 1.49 2006/10/22 11:52:12 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_acl.c,v 1.50 2007/01/12 22:01:03 rwatson Exp $"); #include "opt_mac.h" @@ -66,12 +66,11 @@ acl_type_t type, struct acl *aclp); /* - * These calls wrap the real vnode operations, and are called by the - * syscall code once the syscall has converted the path or file - * descriptor to a vnode (unlocked). The aclp pointer is assumed - * still to point to userland, so this should not be consumed within - * the kernel except by syscall code. Other code should directly - * invoke VOP_{SET,GET}ACL. + * These calls wrap the real vnode operations, and are called by the syscall + * code once the syscall has converted the path or file descriptor to a vnode + * (unlocked). The aclp pointer is assumed still to point to userland, so + * this should not be consumed within the kernel except by syscall code. + * Other code should directly invoke VOP_{SET,GET}ACL. */ /* @@ -180,9 +179,8 @@ } /* - * syscalls -- convert the path/fd to a vnode, and call vacl_whatever. - * Don't need to lock, as the vacl_ code will get/release any locks - * required. + * syscalls -- convert the path/fd to a vnode, and call vacl_whatever. Don't + * need to lock, as the vacl_ code will get/release any locks required. */ /* ==== //depot/projects/smpng/sys/kern/kern_ntptime.c#20 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.60 2006/11/06 13:42:00 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.61 2007/01/12 07:40:30 imp Exp $"); #include "opt_ntp.h" @@ -268,6 +268,7 @@ ntp_gettime1(&ntv); mtx_unlock(&Giant); + td->td_retval[0] = ntv.time_state; return (copyout(&ntv, uap->ntvp, sizeof(ntv))); } ==== //depot/projects/smpng/sys/netatalk/aarp.c#22 (text+ko) ==== @@ -47,7 +47,7 @@ * +1-313-764-2278 * netatalk@umich.edu * - * $FreeBSD: src/sys/netatalk/aarp.c,v 1.41 2007/01/08 17:58:27 rwatson Exp $ + * $FreeBSD: src/sys/netatalk/aarp.c,v 1.42 2007/01/12 12:25:12 rwatson Exp $ */ #include "opt_atalk.h" @@ -75,95 +75,89 @@ #include <security/mac/mac_framework.h> -static void aarptfree(struct aarptab *aat); -static void at_aarpinput(struct ifnet *ifp, struct mbuf *m); +static void aarptfree(struct aarptab *aat); +static void at_aarpinput(struct ifnet *ifp, struct mbuf *m); -#define AARPTAB_BSIZ 9 -#define AARPTAB_NB 19 -#define AARPTAB_SIZE (AARPTAB_BSIZ * AARPTAB_NB) +#define AARPTAB_BSIZ 9 +#define AARPTAB_NB 19 +#define AARPTAB_SIZE (AARPTAB_BSIZ * AARPTAB_NB) static struct aarptab aarptab[AARPTAB_SIZE]; -struct mtx aarptab_mtx; +struct mtx aarptab_mtx; MTX_SYSINIT(aarptab_mtx, &aarptab_mtx, "aarptab_mtx", MTX_DEF); -#define AARPTAB_HASH(a) \ - ((((a).s_net << 8) + (a).s_node) % AARPTAB_NB) +#define AARPTAB_HASH(a) ((((a).s_net << 8) + (a).s_node) % AARPTAB_NB) -#define AARPTAB_LOOK(aat, addr) { \ - int n; \ - AARPTAB_LOCK_ASSERT(); \ - aat = &aarptab[ AARPTAB_HASH(addr) * AARPTAB_BSIZ ]; \ - for (n = 0; n < AARPTAB_BSIZ; n++, aat++) \ - if (aat->aat_ataddr.s_net == (addr).s_net && \ - aat->aat_ataddr.s_node == (addr).s_node) \ - break; \ - if (n >= AARPTAB_BSIZ) \ - aat = NULL; \ -} +#define AARPTAB_LOOK(aat, addr) do { \ + int n; \ + \ + AARPTAB_LOCK_ASSERT(); \ + aat = &aarptab[ AARPTAB_HASH(addr) * AARPTAB_BSIZ ]; \ + for (n = 0; n < AARPTAB_BSIZ; n++, aat++) { \ + if (aat->aat_ataddr.s_net == (addr).s_net && \ + aat->aat_ataddr.s_node == (addr).s_node) \ + break; \ + } \ + if (n >= AARPTAB_BSIZ) \ + aat = NULL; \ +} while (0) -#define AARPT_AGE (60 * 1) -#define AARPT_KILLC 20 -#define AARPT_KILLI 3 +#define AARPT_AGE (60 * 1) +#define AARPT_KILLC 20 +#define AARPT_KILLI 3 -# if !defined(__FreeBSD__) -extern u_char etherbroadcastaddr[6]; -# endif /* __FreeBSD__ */ - -static const u_char atmulticastaddr[ 6 ] = { - 0x09, 0x00, 0x07, 0xff, 0xff, 0xff, +static const u_char atmulticastaddr[6] = { + 0x09, 0x00, 0x07, 0xff, 0xff, 0xff, }; -u_char at_org_code[ 3 ] = { - 0x08, 0x00, 0x07, +u_char at_org_code[3] = { + 0x08, 0x00, 0x07, }; -const u_char aarp_org_code[ 3 ] = { - 0x00, 0x00, 0x00, +const u_char aarp_org_code[3] = { + 0x00, 0x00, 0x00, }; -static struct callout_handle aarptimer_ch = +static struct callout_handle aarptimer_ch = CALLOUT_HANDLE_INITIALIZER(&aarptimer_ch); static void aarptimer(void *ignored) { - struct aarptab *aat; - int i; + struct aarptab *aat; + int i; - aarptimer_ch = timeout(aarptimer, (caddr_t)0, AARPT_AGE * hz); - aat = aarptab; - AARPTAB_LOCK(); - for (i = 0; i < AARPTAB_SIZE; i++, aat++) { - if (aat->aat_flags == 0 || (aat->aat_flags & ATF_PERM)) - continue; - if (++aat->aat_timer < ((aat->aat_flags & ATF_COM) ? - AARPT_KILLC : AARPT_KILLI)) - continue; - aarptfree(aat); - } - AARPTAB_UNLOCK(); + aarptimer_ch = timeout(aarptimer, NULL, AARPT_AGE * hz); + aat = aarptab; + AARPTAB_LOCK(); + for (i = 0; i < AARPTAB_SIZE; i++, aat++) { + if (aat->aat_flags == 0 || (aat->aat_flags & ATF_PERM)) + continue; + if (++aat->aat_timer < ((aat->aat_flags & ATF_COM) ? + AARPT_KILLC : AARPT_KILLI)) + continue; + aarptfree(aat); + } + AARPTAB_UNLOCK(); } /* - * search through the network addresses to find one that includes - * the given network.. remember to take netranges into - * consideration. + * Search through the network addresses to find one that includes the given + * network. Remember to take netranges into consideration. */ struct at_ifaddr * at_ifawithnet(struct sockaddr_at *sat) { - struct at_ifaddr *aa; - struct sockaddr_at *sat2; + struct at_ifaddr *aa; + struct sockaddr_at *sat2; for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { sat2 = &(aa->aa_addr); - if (sat2->sat_addr.s_net == sat->sat_addr.s_net) { - break; - } - if((aa->aa_flags & AFA_PHASE2) - && (ntohs(aa->aa_firstnet) <= ntohs(sat->sat_addr.s_net)) - && (ntohs(aa->aa_lastnet) >= ntohs(sat->sat_addr.s_net))) { + if (sat2->sat_addr.s_net == sat->sat_addr.s_net) + break; + if ((aa->aa_flags & AFA_PHASE2) && + (ntohs(aa->aa_firstnet) <= ntohs(sat->sat_addr.s_net)) && + (ntohs(aa->aa_lastnet) >= ntohs(sat->sat_addr.s_net))) break; - } } return (aa); } @@ -171,521 +165,514 @@ static void aarpwhohas(struct ifnet *ifp, struct sockaddr_at *sat) { - struct mbuf *m; - struct ether_header *eh; - struct ether_aarp *ea; - struct at_ifaddr *aa; - struct llc *llc; - struct sockaddr sa; + struct mbuf *m; + struct ether_header *eh; + struct ether_aarp *ea; + struct at_ifaddr *aa; + struct llc *llc; + struct sockaddr sa; - AARPTAB_UNLOCK_ASSERT(); - if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL) { - return; - } + AARPTAB_UNLOCK_ASSERT(); + m = m_gethdr(M_DONTWAIT, MT_DATA); + if (m == NULL) + return; #ifdef MAC - mac_create_mbuf_linklayer(ifp, m); + mac_create_mbuf_linklayer(ifp, m); #endif - m->m_len = sizeof(*ea); - m->m_pkthdr.len = sizeof(*ea); - MH_ALIGN(m, sizeof(*ea)); + m->m_len = sizeof(*ea); + m->m_pkthdr.len = sizeof(*ea); + MH_ALIGN(m, sizeof(*ea)); - ea = mtod(m, struct ether_aarp *); - bzero((caddr_t)ea, sizeof(*ea)); + ea = mtod(m, struct ether_aarp *); + bzero((caddr_t)ea, sizeof(*ea)); - ea->aarp_hrd = htons(AARPHRD_ETHER); - ea->aarp_pro = htons(ETHERTYPE_AT); - ea->aarp_hln = sizeof(ea->aarp_sha); - ea->aarp_pln = sizeof(ea->aarp_spu); - ea->aarp_op = htons(AARPOP_REQUEST); - bcopy(IF_LLADDR(ifp), (caddr_t)ea->aarp_sha, - sizeof(ea->aarp_sha)); + ea->aarp_hrd = htons(AARPHRD_ETHER); + ea->aarp_pro = htons(ETHERTYPE_AT); + ea->aarp_hln = sizeof(ea->aarp_sha); + ea->aarp_pln = sizeof(ea->aarp_spu); + ea->aarp_op = htons(AARPOP_REQUEST); + bcopy(IF_LLADDR(ifp), (caddr_t)ea->aarp_sha, sizeof(ea->aarp_sha)); - /* - * We need to check whether the output ethernet type should - * be phase 1 or 2. We have the interface that we'll be sending - * the aarp out. We need to find an AppleTalk network on that - * interface with the same address as we're looking for. If the - * net is phase 2, generate an 802.2 and SNAP header. - */ - if ((aa = at_ifawithnet(sat)) == NULL) { - m_freem(m); - return; - } + /* + * We need to check whether the output ethernet type should be phase + * 1 or 2. We have the interface that we'll be sending the aarp out. + * We need to find an AppleTalk network on that interface with the + * same address as we're looking for. If the net is phase 2, + * generate an 802.2 and SNAP header. + */ + if ((aa = at_ifawithnet(sat)) == NULL) { + m_freem(m); + return; + } - eh = (struct ether_header *)sa.sa_data; + eh = (struct ether_header *)sa.sa_data; - if (aa->aa_flags & AFA_PHASE2) { - bcopy(atmulticastaddr, eh->ether_dhost, sizeof(eh->ether_dhost)); - eh->ether_type = htons(sizeof(struct llc) + sizeof(struct ether_aarp)); - M_PREPEND(m, sizeof(struct llc), M_DONTWAIT); - if (m == NULL) { - return; + if (aa->aa_flags & AFA_PHASE2) { + bcopy(atmulticastaddr, eh->ether_dhost, + sizeof(eh->ether_dhost)); + eh->ether_type = htons(sizeof(struct llc) + + sizeof(struct ether_aarp)); + M_PREPEND(m, sizeof(struct llc), M_DONTWAIT); + if (m == NULL) + return; + llc = mtod(m, struct llc *); + llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; + llc->llc_control = LLC_UI; + bcopy(aarp_org_code, llc->llc_org_code, + sizeof(aarp_org_code)); + llc->llc_ether_type = htons(ETHERTYPE_AARP); + bcopy(&AA_SAT(aa)->sat_addr.s_net, ea->aarp_spnet, + sizeof(ea->aarp_spnet)); + bcopy(&sat->sat_addr.s_net, ea->aarp_tpnet, + sizeof(ea->aarp_tpnet)); + ea->aarp_spnode = AA_SAT(aa)->sat_addr.s_node; + ea->aarp_tpnode = sat->sat_addr.s_node; + } else { + bcopy(ifp->if_broadcastaddr, (caddr_t)eh->ether_dhost, + sizeof(eh->ether_dhost)); + eh->ether_type = htons(ETHERTYPE_AARP); + ea->aarp_spa = AA_SAT(aa)->sat_addr.s_node; + ea->aarp_tpa = sat->sat_addr.s_node; } - llc = mtod(m, struct llc *); - llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; - llc->llc_control = LLC_UI; - bcopy(aarp_org_code, llc->llc_org_code, sizeof(aarp_org_code)); - llc->llc_ether_type = htons(ETHERTYPE_AARP); - - bcopy(&AA_SAT(aa)->sat_addr.s_net, ea->aarp_spnet, - sizeof(ea->aarp_spnet)); - bcopy(&sat->sat_addr.s_net, ea->aarp_tpnet, - sizeof(ea->aarp_tpnet)); - ea->aarp_spnode = AA_SAT(aa)->sat_addr.s_node; - ea->aarp_tpnode = sat->sat_addr.s_node; - } else { - bcopy(ifp->if_broadcastaddr, (caddr_t)eh->ether_dhost, - sizeof(eh->ether_dhost)); - eh->ether_type = htons(ETHERTYPE_AARP); - - ea->aarp_spa = AA_SAT(aa)->sat_addr.s_node; - ea->aarp_tpa = sat->sat_addr.s_node; - } #ifdef NETATALKDEBUG - printf("aarp: sending request for %u.%u\n", - ntohs(AA_SAT(aa)->sat_addr.s_net), - AA_SAT(aa)->sat_addr.s_node); + printf("aarp: sending request for %u.%u\n", + ntohs(AA_SAT(aa)->sat_addr.s_net), AA_SAT(aa)->sat_addr.s_node); #endif /* NETATALKDEBUG */ - sa.sa_len = sizeof(struct sockaddr); - sa.sa_family = AF_UNSPEC; - ifp->if_output(ifp, m, &sa, NULL /* route */); + sa.sa_len = sizeof(struct sockaddr); + sa.sa_family = AF_UNSPEC; + ifp->if_output(ifp, m, &sa, NULL); } int -aarpresolve(ifp, m, destsat, desten) - struct ifnet *ifp; - struct mbuf *m; - struct sockaddr_at *destsat; - u_char *desten; +aarpresolve(struct ifnet *ifp, struct mbuf *m, struct sockaddr_at *destsat, + u_char *desten) { - struct at_ifaddr *aa; - struct aarptab *aat; + struct at_ifaddr *aa; + struct aarptab *aat; - if (at_broadcast(destsat)) { - m->m_flags |= M_BCAST; - if ((aa = at_ifawithnet(destsat)) == NULL) { - m_freem(m); - return (0); + if (at_broadcast(destsat)) { + m->m_flags |= M_BCAST; + if ((aa = at_ifawithnet(destsat)) == NULL) { + m_freem(m); + return (0); + } + if (aa->aa_flags & AFA_PHASE2) + bcopy(atmulticastaddr, (caddr_t)desten, + sizeof(atmulticastaddr)); + else + bcopy(ifp->if_broadcastaddr, (caddr_t)desten, + sizeof(ifp->if_addrlen)); + return (1); } - if (aa->aa_flags & AFA_PHASE2) { - bcopy(atmulticastaddr, (caddr_t)desten, sizeof(atmulticastaddr)); - } else { - bcopy(ifp->if_broadcastaddr, (caddr_t)desten, - sizeof(ifp->if_addrlen)); + + AARPTAB_LOCK(); + AARPTAB_LOOK(aat, destsat->sat_addr); + if (aat == NULL) { + /* No entry. */ + aat = aarptnew(&destsat->sat_addr); + + /* We should fail more gracefully. */ + if (aat == NULL) + panic("aarpresolve: no free entry"); + goto done; } - return (1); - } - AARPTAB_LOCK(); - AARPTAB_LOOK(aat, destsat->sat_addr); - if (aat == NULL) { /* No entry */ - aat = aarptnew(&destsat->sat_addr); - if (aat == NULL) { /* we should fail more gracefully! */ - panic("aarpresolve: no free entry"); + /* Found an entry. */ + aat->aat_timer = 0; + if (aat->aat_flags & ATF_COM) { + /* Entry is COMplete. */ + bcopy((caddr_t)aat->aat_enaddr, (caddr_t)desten, + sizeof(aat->aat_enaddr)); + AARPTAB_UNLOCK(); + return (1); } - goto done; - } - /* found an entry */ - aat->aat_timer = 0; - if (aat->aat_flags & ATF_COM) { /* entry is COMplete */ - bcopy((caddr_t)aat->aat_enaddr, (caddr_t)desten, - sizeof(aat->aat_enaddr)); + + /* Entry has not completed. */ + if (aat->aat_hold) + m_freem(aat->aat_hold); +done: + aat->aat_hold = m; AARPTAB_UNLOCK(); - return (1); - } - /* entry has not completed */ - if (aat->aat_hold) { - m_freem(aat->aat_hold); - } -done: - aat->aat_hold = m; - AARPTAB_UNLOCK(); - aarpwhohas(ifp, destsat); - return (0); + aarpwhohas(ifp, destsat); + return (0); } void -aarpintr(m) - struct mbuf *m; +aarpintr(struct mbuf *m) { - struct arphdr *ar; - struct ifnet *ifp; + struct arphdr *ar; + struct ifnet *ifp; - ifp = m->m_pkthdr.rcvif; - if (ifp->if_flags & IFF_NOARP) - goto out; + ifp = m->m_pkthdr.rcvif; + if (ifp->if_flags & IFF_NOARP) + goto out; - if (m->m_len < sizeof(struct arphdr)) { - goto out; - } + if (m->m_len < sizeof(struct arphdr)) + goto out; - ar = mtod(m, struct arphdr *); - if (ntohs(ar->ar_hrd) != AARPHRD_ETHER) { - goto out; - } - - if (m->m_len < sizeof(struct arphdr) + 2 * ar->ar_hln + - 2 * ar->ar_pln) { - goto out; - } - - switch(ntohs(ar->ar_pro)) { - case ETHERTYPE_AT : - at_aarpinput(ifp, m); - return; - - default: - break; - } + ar = mtod(m, struct arphdr *); + if (ntohs(ar->ar_hrd) != AARPHRD_ETHER) + goto out; + + if (m->m_len < sizeof(struct arphdr) + 2 * ar->ar_hln + + 2 * ar->ar_pln) + goto out; + + switch(ntohs(ar->ar_pro)) { + case ETHERTYPE_AT: + at_aarpinput(ifp, m); + return; + default: + break; + } out: - m_freem(m); + m_freem(m); } static void at_aarpinput(struct ifnet *ifp, struct mbuf *m) { - struct ether_aarp *ea; - struct at_ifaddr *aa; - struct aarptab *aat; - struct ether_header *eh; - struct llc *llc; - struct sockaddr_at sat; - struct sockaddr sa; - struct at_addr spa, tpa, ma; - int op; - u_short net; + struct ether_aarp *ea; + struct at_ifaddr *aa; + struct aarptab *aat; + struct ether_header *eh; + struct llc *llc; + struct sockaddr_at sat; + struct sockaddr sa; + struct at_addr spa, tpa, ma; + int op; + u_short net; - ea = mtod(m, struct ether_aarp *); + ea = mtod(m, struct ether_aarp *); - /* Check to see if from my hardware address */ - if (!bcmp((caddr_t)ea->aarp_sha, IF_LLADDR(ifp), ETHER_ADDR_LEN)) { - m_freem(m); - return; - } + /* Check to see if from my hardware address. */ + if (!bcmp((caddr_t)ea->aarp_sha, IF_LLADDR(ifp), ETHER_ADDR_LEN)) { + m_freem(m); + return; + } - op = ntohs(ea->aarp_op); - bcopy(ea->aarp_tpnet, &net, sizeof(net)); + op = ntohs(ea->aarp_op); + bcopy(ea->aarp_tpnet, &net, sizeof(net)); - if (net != 0) { /* should be ATADDR_ANYNET? */ - sat.sat_len = sizeof(struct sockaddr_at); - sat.sat_family = AF_APPLETALK; - sat.sat_addr.s_net = net; - if ((aa = at_ifawithnet(&sat)) == NULL) { - m_freem(m); - return; + if (net != 0) { + /* Should be ATADDR_ANYNET? */ + sat.sat_len = sizeof(struct sockaddr_at); + sat.sat_family = AF_APPLETALK; + sat.sat_addr.s_net = net; + if ((aa = at_ifawithnet(&sat)) == NULL) { + m_freem(m); + return; + } + bcopy(ea->aarp_spnet, &spa.s_net, sizeof(spa.s_net)); + bcopy(ea->aarp_tpnet, &tpa.s_net, sizeof(tpa.s_net)); + } else { + /* + * Since we don't know the net, we just look for the first + * phase 1 address on the interface. + */ + for (aa = (struct at_ifaddr *)TAILQ_FIRST(&ifp->if_addrhead); + aa; + aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) { + if (AA_SAT(aa)->sat_family == AF_APPLETALK && + (aa->aa_flags & AFA_PHASE2) == 0) { + break; + } + } + if (aa == NULL) { + m_freem(m); + return; + } + tpa.s_net = spa.s_net = AA_SAT(aa)->sat_addr.s_net; } - bcopy(ea->aarp_spnet, &spa.s_net, sizeof(spa.s_net)); - bcopy(ea->aarp_tpnet, &tpa.s_net, sizeof(tpa.s_net)); - } else { + + spa.s_node = ea->aarp_spnode; + tpa.s_node = ea->aarp_tpnode; + ma.s_net = AA_SAT(aa)->sat_addr.s_net; + ma.s_node = AA_SAT(aa)->sat_addr.s_node; + /* - * Since we don't know the net, we just look for the first - * phase 1 address on the interface. + * This looks like it's from us. */ - for (aa = (struct at_ifaddr *)TAILQ_FIRST(&ifp->if_addrhead); aa; - aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) { - if (AA_SAT(aa)->sat_family == AF_APPLETALK && - (aa->aa_flags & AFA_PHASE2) == 0) { - break; - } + if (spa.s_net == ma.s_net && spa.s_node == ma.s_node) { + if (aa->aa_flags & AFA_PROBING) { + /* + * We're probing, someone either responded to our + * probe, or probed for the same address we'd like to + * use. Change the address we're probing for. + */ + callout_stop(&aa->aa_callout); + wakeup(aa); + m_freem(m); + return; + } else if (op != AARPOP_PROBE) { + /* + * This is not a probe, and we're not probing. This + * means that someone's saying they have the same + * source address as the one we're using. Get upset. + */ + log(LOG_ERR, + "aarp: duplicate AT address!! %x:%x:%x:%x:%x:%x\n", + ea->aarp_sha[0], ea->aarp_sha[1], + ea->aarp_sha[2], ea->aarp_sha[3], + ea->aarp_sha[4], ea->aarp_sha[5]); + m_freem(m); + return; + } } - if (aa == NULL) { - m_freem(m); - return; - } - tpa.s_net = spa.s_net = AA_SAT(aa)->sat_addr.s_net; - } - spa.s_node = ea->aarp_spnode; - tpa.s_node = ea->aarp_tpnode; - ma.s_net = AA_SAT(aa)->sat_addr.s_net; >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701122235.l0CMZJ2s007930>