From owner-p4-projects@FreeBSD.ORG Sun Mar 21 20:05:23 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5E1E516A4D0; Sun, 21 Mar 2004 20:05:23 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3823F16A4CE for ; Sun, 21 Mar 2004 20:05:23 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2C84543D1D for ; Sun, 21 Mar 2004 20:05:23 -0800 (PST) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i2M45NGe003051 for ; Sun, 21 Mar 2004 20:05:23 -0800 (PST) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i2M45MA8003048 for perforce@freebsd.org; Sun, 21 Mar 2004 20:05:22 -0800 (PST) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Sun, 21 Mar 2004 20:05:22 -0800 (PST) Message-Id: <200403220405.i2M45MA8003048@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Subject: PERFORCE change 49504 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2004 04:05:23 -0000 http://perforce.freebsd.org/chv.cgi?CH=49504 Change 49504 by rwatson@rwatson_paprika on 2004/03/21 20:04:41 Integrate netperf_socket: - if_arcsubr compile fix - More gratuitous style changes to netatalk Affected files ... .. //depot/projects/netperf_socket/sys/net/if_arcsubr.c#4 integrate .. //depot/projects/netperf_socket/sys/netatalk/aarp.c#4 integrate .. //depot/projects/netperf_socket/sys/netatalk/at_control.c#4 integrate .. //depot/projects/netperf_socket/sys/netatalk/at_rmx.c#2 integrate .. //depot/projects/netperf_socket/sys/netatalk/ddp_input.c#3 integrate .. //depot/projects/netperf_socket/sys/netatalk/ddp_pcb.c#4 integrate .. //depot/projects/netperf_socket/sys/netatalk/ddp_usrreq.c#7 integrate Differences ... ==== //depot/projects/netperf_socket/sys/net/if_arcsubr.c#4 (text+ko) ==== @@ -1,5 +1,5 @@ /* $NetBSD: if_arcsubr.c,v 1.36 2001/06/14 05:44:23 itojun Exp $ */ -/* $FreeBSD: src/sys/net/if_arcsubr.c,v 1.17 2004/03/21 17:27:41 mdodd Exp $ */ +/* $FreeBSD: src/sys/net/if_arcsubr.c,v 1.18 2004/03/22 03:52:51 mdodd Exp $ */ /* * Copyright (c) 1994, 1995 Ignatios Souvatzis @@ -163,9 +163,9 @@ } if (m->m_flags & M_BCAST) - bcopy(ifp->if_broadcastaddr, adst, ARC_ADDR_LEN); + bcopy(ifp->if_broadcastaddr, &adst, ARC_ADDR_LEN); else - bcopy(ar_tha(ah), adst, ARC_ADDR_LEN); + bcopy(ar_tha(ah), &adst, ARC_ADDR_LEN); } break; ==== //depot/projects/netperf_socket/sys/netatalk/aarp.c#4 (text+ko) ==== @@ -2,7 +2,7 @@ * Copyright (c) 1990,1991 Regents of The University of Michigan. * All Rights Reserved. * - * $FreeBSD: src/sys/netatalk/aarp.c,v 1.26 2004/03/22 03:24:10 rwatson Exp $ + * $FreeBSD: src/sys/netatalk/aarp.c,v 1.27 2004/03/22 03:57:01 rwatson Exp $ */ #include "opt_atalk.h" @@ -39,7 +39,7 @@ #define AARPTAB_HASH(a) \ ((((a).s_net << 8) + (a).s_node) % AARPTAB_NB) -#define AARPTAB_LOOK(aat,addr) { \ +#define AARPTAB_LOOK(aat, addr) { \ int n; \ aat = &aarptab[ AARPTAB_HASH(addr) * AARPTAB_BSIZ ]; \ for (n = 0; n < AARPTAB_BSIZ; n++, aat++) \ @@ -47,7 +47,7 @@ aat->aat_ataddr.s_node == (addr).s_node) \ break; \ if (n >= AARPTAB_BSIZ) \ - aat = 0; \ + aat = NULL; \ } #define AARPT_AGE (60 * 1) @@ -233,9 +233,9 @@ s = splimp(); AARPTAB_LOOK(aat, destsat->sat_addr); - if (aat == 0) { /* No entry */ + if (aat == NULL) { /* No entry */ aat = aarptnew(&destsat->sat_addr); - if (aat == 0) { + if (aat == NULL) { panic("aarpresolve: no free entry"); } aat->aat_hold = m; @@ -391,7 +391,7 @@ } AARPTAB_LOOK(aat, spa); - if (aat) { + if (aat != NULL) { if (op == AARPOP_PROBE) { /* * Someone's probing for spa, dealocate the one we've got, ==== //depot/projects/netperf_socket/sys/netatalk/at_control.c#4 (text+ko) ==== @@ -2,7 +2,7 @@ * Copyright (c) 1990,1991 Regents of The University of Michigan. * All Rights Reserved. * - * $FreeBSD: src/sys/netatalk/at_control.c,v 1.37 2004/03/22 03:24:10 rwatson Exp $ + * $FreeBSD: src/sys/netatalk/at_control.c,v 1.38 2004/03/22 03:57:01 rwatson Exp $ */ #include @@ -56,7 +56,7 @@ /* * If we have an ifp, then find the matching at_ifaddr if it exists */ - if (ifp) { + if (ifp != NULL) { for (aa = at_ifaddr; aa; aa = aa->aa_next) { if (aa->aa_ifp == ifp) break; } @@ -554,7 +554,7 @@ * Now that we have selected an address, we need to tell the interface * about it, just in case it needs to adjust something. */ - if (ifp->if_ioctl && + if (ifp->if_ioctl != NULL&& (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)aa))) { /* * of course this could mean that it objects violently ==== //depot/projects/netperf_socket/sys/netatalk/at_rmx.c#2 (text+ko) ==== @@ -27,6 +27,7 @@ * SUCH DAMAGE. * * at_rmx.c,v 1.13 1995/05/30 08:09:31 rgrimes Exp + * $FreeBSD: src/sys/netatalk/at_rmx.c,v 1.7 2004/03/22 03:57:01 rwatson Exp $ */ /* This code generates debugging traces to the radix code */ @@ -47,7 +48,7 @@ char *bp = &hexbuf[0]; u_char *cp = v; - if (v) { + if (v != NULL) { int len = *cp; u_char *cplim = cp + len; ==== //depot/projects/netperf_socket/sys/netatalk/ddp_input.c#3 (text+ko) ==== @@ -2,7 +2,7 @@ * Copyright (c) 1990,1994 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. * - * $FreeBSD: src/sys/netatalk/ddp_input.c,v 1.20 2004/03/21 03:28:08 rwatson Exp $ + * $FreeBSD: src/sys/netatalk/ddp_input.c,v 1.22 2004/03/22 03:57:01 rwatson Exp $ */ #include "opt_mac.h" @@ -79,7 +79,7 @@ } static void -ddp_input( m, ifp, elh, phase ) +ddp_input(m, ifp, elh, phase) struct mbuf *m; struct ifnet *ifp; struct elaphdr *elh; @@ -93,9 +93,9 @@ int dlen, mlen; u_short cksum = 0; - bzero( (caddr_t)&from, sizeof( struct sockaddr_at )); - bzero( (caddr_t)&to, sizeof( struct sockaddr_at )); - if ( elh ) { + bzero((caddr_t)&from, sizeof(struct sockaddr_at)); + bzero((caddr_t)&to, sizeof(struct sockaddr_at)); + if (elh != NULL) { /* * Extract the information in the short header. * netowrk information is defaulted to ATADDR_ANYNET @@ -104,15 +104,15 @@ */ ddpstat.ddps_short++; - if ( m->m_len < sizeof( struct ddpshdr ) && - (( m = m_pullup( m, sizeof( struct ddpshdr ))) == NULL )) { + if (m->m_len < sizeof(struct ddpshdr) && + ((m = m_pullup(m, sizeof(struct ddpshdr))) == NULL)) { ddpstat.ddps_tooshort++; return; } - dsh = mtod( m, struct ddpshdr *); - bcopy( (caddr_t)dsh, (caddr_t)&ddps, sizeof( struct ddpshdr )); - ddps.dsh_bytes = ntohl( ddps.dsh_bytes ); + dsh = mtod(m, struct ddpshdr *); + bcopy((caddr_t)dsh, (caddr_t)&ddps, sizeof(struct ddpshdr)); + ddps.dsh_bytes = ntohl(ddps.dsh_bytes); dlen = ddps.dsh_len; to.sat_addr.s_net = ATADDR_ANYNET; @@ -126,10 +126,10 @@ * Make sure that we point to the phase1 ifaddr info * and that it's valid for this packet. */ - for ( aa = at_ifaddr; aa; aa = aa->aa_next ) { - if ( (aa->aa_ifp == ifp) - && ( (aa->aa_flags & AFA_PHASE2) == 0) - && ( (to.sat_addr.s_node == AA_SAT( aa )->sat_addr.s_node) + for (aa = at_ifaddr; aa; aa = aa->aa_next) { + if ((aa->aa_ifp == ifp) + && ((aa->aa_flags & AFA_PHASE2) == 0) + && ((to.sat_addr.s_node == AA_SAT(aa)->sat_addr.s_node) || (to.sat_addr.s_node == ATADDR_BCAST))) { break; } @@ -137,8 +137,8 @@ /* * maybe we got a broadcast not meant for us.. ditch it. */ - if ( aa == NULL ) { - m_freem( m ); + if (aa == NULL) { + m_freem(m); return; } } else { @@ -150,18 +150,18 @@ */ ddpstat.ddps_long++; - if ( m->m_len < sizeof( struct ddpehdr ) && - (( m = m_pullup( m, sizeof( struct ddpehdr ))) == NULL )) { + if (m->m_len < sizeof(struct ddpehdr) && + ((m = m_pullup(m, sizeof(struct ddpehdr))) == NULL)) { ddpstat.ddps_tooshort++; return; } - deh = mtod( m, struct ddpehdr *); - bcopy( (caddr_t)deh, (caddr_t)&ddpe, sizeof( struct ddpehdr )); - ddpe.deh_bytes = ntohl( ddpe.deh_bytes ); + deh = mtod(m, struct ddpehdr *); + bcopy((caddr_t)deh, (caddr_t)&ddpe, sizeof(struct ddpehdr)); + ddpe.deh_bytes = ntohl(ddpe.deh_bytes); dlen = ddpe.deh_len; - if (( cksum = ddpe.deh_sum ) == 0 ) { + if ((cksum = ddpe.deh_sum) == 0) { ddpstat.ddps_nosum++; } @@ -172,7 +172,7 @@ to.sat_addr.s_node = ddpe.deh_dnode; to.sat_port = ddpe.deh_dport; - if ( to.sat_addr.s_net == ATADDR_ANYNET ) { + if (to.sat_addr.s_net == ATADDR_ANYNET) { /* * The TO address doesn't specify a net, * So by definition it's for this net. @@ -185,15 +185,15 @@ * this node number will match (which may NOT be what we want, * but it's probably safe in 99.999% of cases. */ - for ( aa = at_ifaddr; aa; aa = aa->aa_next ) { - if ( phase == 1 && ( aa->aa_flags & AFA_PHASE2 )) { + for (aa = at_ifaddr; aa; aa = aa->aa_next) { + if (phase == 1 && (aa->aa_flags & AFA_PHASE2)) { continue; } - if ( phase == 2 && ( aa->aa_flags & AFA_PHASE2 ) == 0 ) { + if (phase == 2 && (aa->aa_flags & AFA_PHASE2) == 0) { continue; } - if ( (aa->aa_ifp == ifp) - && ( (to.sat_addr.s_node == AA_SAT( aa )->sat_addr.s_node) + if ((aa->aa_ifp == ifp) + && ((to.sat_addr.s_node == AA_SAT(aa)->sat_addr.s_node) || (to.sat_addr.s_node == ATADDR_BCAST) || (ifp->if_flags & IFF_LOOPBACK))) { break; @@ -204,13 +204,13 @@ * A destination network was given. We just try to find * which ifaddr info matches it. */ - for ( aa = at_ifaddr; aa; aa = aa->aa_next ) { + for (aa = at_ifaddr; aa; aa = aa->aa_next) { /* * This is a kludge. Accept packets that are * for any router on a local netrange. */ - if ( to.sat_addr.s_net == aa->aa_firstnet && - to.sat_addr.s_node == 0 ) { + if (to.sat_addr.s_net == aa->aa_firstnet && + to.sat_addr.s_node == 0) { break; } /* @@ -219,10 +219,10 @@ * Startup packets are always implicitly allowed on to * the next test. */ - if ((( ntohs( to.sat_addr.s_net ) < ntohs( aa->aa_firstnet )) - || (ntohs( to.sat_addr.s_net ) > ntohs( aa->aa_lastnet ))) - && (( ntohs( to.sat_addr.s_net ) < 0xff00) - || (ntohs( to.sat_addr.s_net ) > 0xfffe ))) { + if (((ntohs(to.sat_addr.s_net) < ntohs(aa->aa_firstnet)) + || (ntohs(to.sat_addr.s_net) > ntohs(aa->aa_lastnet))) + && ((ntohs(to.sat_addr.s_net) < 0xff00) + || (ntohs(to.sat_addr.s_net) > 0xfffe))) { continue; } @@ -231,8 +231,8 @@ * in the node address. This can have if the interface * is in promiscuous mode for example. */ - if (( to.sat_addr.s_node != AA_SAT( aa )->sat_addr.s_node) - && (to.sat_addr.s_node != ATADDR_BCAST) ) { + if ((to.sat_addr.s_node != AA_SAT(aa)->sat_addr.s_node) + && (to.sat_addr.s_node != ATADDR_BCAST)) { continue; } break; @@ -246,13 +246,13 @@ * possibly on a different media. */ mlen = m->m_pkthdr.len; - if ( mlen < dlen ) { + if (mlen < dlen) { ddpstat.ddps_toosmall++; - m_freem( m ); + m_freem(m); return; } - if ( mlen > dlen ) { - m_adj( m, dlen - mlen ); + if (mlen > dlen) { + m_adj(m, dlen - mlen); } /* @@ -262,24 +262,24 @@ * As we are not really a router this is a bit cheeky, but it may be * useful some day. */ - if ( (aa == NULL) - || ( (to.sat_addr.s_node == ATADDR_BCAST) + if ((aa == NULL) + || ((to.sat_addr.s_node == ATADDR_BCAST) && (aa->aa_ifp != ifp) - && (( ifp->if_flags & IFF_LOOPBACK ) == 0 ))) { + && ((ifp->if_flags & IFF_LOOPBACK) == 0))) { /* * If we've explicitly disabled it, don't route anything */ - if ( ddp_forward == 0 ) { - m_freem( m ); + if (ddp_forward == 0) { + m_freem(m); return; } /* * If the cached forwarding route is still valid, use it. */ - if ( forwro.ro_rt - && ( satosat(&forwro.ro_dst)->sat_addr.s_net != to.sat_addr.s_net - || satosat(&forwro.ro_dst)->sat_addr.s_node != to.sat_addr.s_node )) { - RTFREE( forwro.ro_rt ); + if (forwro.ro_rt + && (satosat(&forwro.ro_dst)->sat_addr.s_net != to.sat_addr.s_net + || satosat(&forwro.ro_dst)->sat_addr.s_node != to.sat_addr.s_node)) { + RTFREE(forwro.ro_rt); forwro.ro_rt = NULL; } @@ -288,8 +288,8 @@ * Then get a new route. * XXX this could cause a 'route leak'. check this! */ - if ( forwro.ro_rt == NULL || forwro.ro_rt->rt_ifp == NULL ) { - forwro.ro_dst.sa_len = sizeof( struct sockaddr_at ); + if (forwro.ro_rt == NULL || forwro.ro_rt->rt_ifp == NULL) { + forwro.ro_dst.sa_len = sizeof(struct sockaddr_at); forwro.ro_dst.sa_family = AF_APPLETALK; satosat(&forwro.ro_dst)->sat_addr.s_net = to.sat_addr.s_net; satosat(&forwro.ro_dst)->sat_addr.s_node = to.sat_addr.s_node; @@ -300,9 +300,9 @@ * If it's not going to get there on this hop, and it's * already done too many hops, then throw it away. */ - if ( (to.sat_addr.s_net != satosat( &forwro.ro_dst )->sat_addr.s_net) - && (ddpe.deh_hops == DDP_MAXHOPS) ) { - m_freem( m ); + if ((to.sat_addr.s_net != satosat(&forwro.ro_dst)->sat_addr.s_net) + && (ddpe.deh_hops == DDP_MAXHOPS)) { + m_freem(m); return; } @@ -311,10 +311,10 @@ * to forward the packet, which this would not effect. * Don't allow packets to cross from one interface to another however. */ - if ( ddp_firewall - && ( (forwro.ro_rt == NULL) + if (ddp_firewall + && ((forwro.ro_rt == NULL) || (forwro.ro_rt->rt_ifp != ifp))) { - m_freem( m ); + m_freem(m); return; } @@ -325,9 +325,9 @@ * XXX what about promiscuous mode, etc... */ ddpe.deh_hops++; - ddpe.deh_bytes = htonl( ddpe.deh_bytes ); - bcopy( (caddr_t)&ddpe, (caddr_t)deh, sizeof( u_short )); /* XXX deh? */ - if ( ddp_route( m, &forwro )) { + ddpe.deh_bytes = htonl(ddpe.deh_bytes); + bcopy((caddr_t)&ddpe, (caddr_t)deh, sizeof(u_short)); /* XXX deh? */ + if (ddp_route(m, &forwro)) { ddpstat.ddps_cantforward++; } else { ddpstat.ddps_forward++; @@ -338,36 +338,36 @@ /* * It was for us, and we have an ifaddr to use with it. */ - from.sat_len = sizeof( struct sockaddr_at ); + from.sat_len = sizeof(struct sockaddr_at); from.sat_family = AF_APPLETALK; /* * We are no longer interested in the link layer. * so cut it off. */ - if ( elh ) { - m_adj( m, sizeof( struct ddpshdr )); + if (elh != NULL) { + m_adj(m, sizeof(struct ddpshdr)); } else { - if ( ddp_cksum && cksum && cksum != at_cksum( m, sizeof( int ))) { + if (ddp_cksum && cksum && cksum != at_cksum(m, sizeof(int))) { ddpstat.ddps_badsum++; - m_freem( m ); + m_freem(m); return; } - m_adj( m, sizeof( struct ddpehdr )); + m_adj(m, sizeof(struct ddpehdr)); } /* * Search for ddp protocol control blocks that match these * addresses. */ - if (( ddp = ddp_search( &from, &to, aa )) == NULL ) { - m_freem( m ); + if ((ddp = ddp_search(&from, &to, aa)) == NULL) { + m_freem(m); return; } #ifdef MAC if (mac_check_socket_deliver(ddp->ddp_socket, m) != 0) { - m_freem( m ); + m_freem(m); return; } #endif @@ -375,19 +375,19 @@ /* * If we found one, deliver th epacket to the socket */ - if ( sbappendaddr( &ddp->ddp_socket->so_rcv, (struct sockaddr *)&from, - m, NULL ) == 0 ) { + if (sbappendaddr(&ddp->ddp_socket->so_rcv, (struct sockaddr *)&from, + m, NULL) == 0) { /* * If the socket is full (or similar error) dump the packet. */ ddpstat.ddps_nosockspace++; - m_freem( m ); + m_freem(m); return; } /* * And wake up whatever might be waiting for it */ - sorwakeup( ddp->ddp_socket ); + sorwakeup(ddp->ddp_socket); } #if 0 @@ -400,27 +400,27 @@ char hexdig[] = "0123456789ABCDEF"; static void -bprint( char *data, int len ) +bprint(char *data, int len) { char xout[ BPXLEN ], aout[ BPALEN ]; int i = 0; - bzero( xout, BPXLEN ); - bzero( aout, BPALEN ); + bzero(xout, BPXLEN); + bzero(aout, BPALEN); - for ( ;; ) { - if ( len < 1 ) { - if ( i != 0 ) { - printf( "%s\t%s\n", xout, aout ); + for (;;) { + if (len < 1) { + if (i != 0) { + printf("%s\t%s\n", xout, aout); } - printf( "%s\n", "(end)" ); + printf("%s\n", "(end)"); break; } - xout[ (i*3) ] = hexdig[ ( *data & 0xf0 ) >> 4 ]; + xout[ (i*3) ] = hexdig[ (*data & 0xf0) >> 4 ]; xout[ (i*3) + 1 ] = hexdig[ *data & 0x0f ]; - if ( (u_char)*data < 0x7f && (u_char)*data > 0x20 ) { + if ((u_char)*data < 0x7f && (u_char)*data > 0x20) { aout[ i ] = *data; } else { aout[ i ] = '.'; @@ -432,10 +432,10 @@ len--; data++; - if ( i > BPALEN - 2 ) { - printf( "%s\t%s\n", xout, aout ); - bzero( xout, BPXLEN ); - bzero( aout, BPALEN ); + if (i > BPALEN - 2) { + printf("%s\t%s\n", xout, aout); + bzero(xout, BPXLEN); + bzero(aout, BPALEN); i = 0; continue; } @@ -443,10 +443,10 @@ } static void -m_printm( struct mbuf *m ) +m_printm(struct mbuf *m) { - for (; m; m = m->m_next ) { - bprint( mtod( m, char * ), m->m_len ); + for (; m; m = m->m_next) { + bprint(mtod(m, char *), m->m_len); } } #endif ==== //depot/projects/netperf_socket/sys/netatalk/ddp_pcb.c#4 (text+ko) ==== @@ -2,7 +2,7 @@ * Copyright (c) 1990,1994 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. * - * $FreeBSD: src/sys/netatalk/ddp_pcb.c,v 1.39 2004/03/22 03:24:10 rwatson Exp $ + * $FreeBSD: src/sys/netatalk/ddp_pcb.c,v 1.40 2004/03/22 03:57:01 rwatson Exp $ */ #include @@ -239,7 +239,7 @@ ddp->ddp_prev = NULL; ddp->ddp_pprev = NULL; ddp->ddp_pnext = NULL; - if (ddpcb) { + if (ddpcb != NULL) { ddpcb->ddp_prev = ddp; } ddpcb = ddp; ==== //depot/projects/netperf_socket/sys/netatalk/ddp_usrreq.c#7 (text+ko) ==== @@ -2,7 +2,7 @@ * Copyright (c) 1990,1994 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. * - * $FreeBSD: src/sys/netatalk/ddp_usrreq.c,v 1.37 2004/03/22 03:24:10 rwatson Exp $ + * $FreeBSD: src/sys/netatalk/ddp_usrreq.c,v 1.38 2004/03/22 03:57:01 rwatson Exp $ */ #include @@ -159,7 +159,7 @@ return (EINVAL); } - if (addr) { + if (addr != NULL) { if (ddp->ddp_fsat.sat_port != ATADDR_ANYPORT) { return (EISCONN); } @@ -178,7 +178,7 @@ s = splnet(); error = ddp_output(m, so); - if (addr) { + if (addr != NULL) { at_pcbdisconnect(ddp); } splx(s);