Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jun 1998 19:34:16 -0700
From:      Julian Elischer <julian@whistle.com>
To:        hackers@FreeBSD.ORG
Cc:        netatalk@umich.edu
Subject:   [patch] netatalk broken in 3.0 
Message-ID:  <3585D9A8.15FB7483@whistle.com>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--------------3F54BC7E1CFBAE3959E2B600
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The netatalk port for FreeBSD doesn't work on FreeBSD because of an
apparently gratuitous change in the 3.0 kernel.

in 3.0 you need to use a correct AF_LINK sockaddr (sockaddr_dl)
for setting a hardware multicast address. In most other systems
including 2.2.x this is a AF_UNSPEC (as used by arp).

this patch patches two files in the etc/atalkd directory of netatalk.

can someone who knows how to fix ports commit it?


(CC'd to netatalk list)

julian (off to usenix)

--------------3F54BC7E1CFBAE3959E2B600
Content-Type: text/plain; charset=us-ascii; name="d1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="d1"

Index: nbp.c
===================================================================
RCS file: /cvs/mod/umich/netatalk/etc/atalkd/nbp.c,v
retrieving revision 1.1.1.3.2.1
retrieving revision 1.1.1.3.2.2
diff -c -r1.1.1.3.2.1 -r1.1.1.3.2.2
*** nbp.c	1998/01/10 00:09:18	1.1.1.3.2.1
--- nbp.c	1998/06/16 02:24:27	1.1.1.3.2.2
***************
*** 9,14 ****
--- 9,17 ----
  #include <sys/socket.h>
  #include <sys/ioctl.h>
  #include <net/if.h>
+ #if ( __FreeBSD__ >= 3 )
+ #include <net/if_dl.h>
+ #endif
  #include <netatalk/at.h>
  #include <atalk/ddp.h>
  #include <atalk/nbp.h>
***************
*** 176,184 ****
  	    }
  	    bcopy( zone_mcast( zt->zt_name, zt->zt_len ), zt->zt_bcast,
  		    sizeof( ethermulti ));
  	    bzero( &sa, sizeof( struct sockaddr ));
  	    bcopy( zt->zt_bcast, sa.sa_data, sizeof( ethermulti ));
! 
  	    for ( iface = interfaces; iface; iface = iface->i_next ) {
  		if (( iface->i_flags & IFACE_PHASE2 ) == 0 ) {
  		    continue;
--- 179,201 ----
  	    }
  	    bcopy( zone_mcast( zt->zt_name, zt->zt_len ), zt->zt_bcast,
  		    sizeof( ethermulti ));
+ #if ( __FreeBSD__ >= 3 )
+             struct sockaddr_dl *dlp;
+ 
+             /* configure multicast for this interface */
+             bzero( &sa, sizeof( struct sockaddr ));
+             dlp = (struct sockaddr_dl *)&sa;
+             dlp->sdl_len = sizeof(struct sockaddr_dl);
+             dlp->sdl_family = AF_LINK;
+             dlp->sdl_index = 0;
+             dlp->sdl_nlen = 0;
+             dlp->sdl_alen = 6;
+             dlp->sdl_slen = 0;
+             bcopy (zt->zt_bcast, LLADDR(dlp), sizeof( ethermulti ));
+ #else
  	    bzero( &sa, sizeof( struct sockaddr ));
  	    bcopy( zt->zt_bcast, sa.sa_data, sizeof( ethermulti ));
! #endif      
  	    for ( iface = interfaces; iface; iface = iface->i_next ) {
  		if (( iface->i_flags & IFACE_PHASE2 ) == 0 ) {
  		    continue;
Index: main.c
===================================================================
RCS file: /cvs/mod/umich/netatalk/etc/atalkd/main.c,v
retrieving revision 1.1.1.3.2.3
retrieving revision 1.1.1.3.2.4
diff -c -r1.1.1.3.2.3 -r1.1.1.3.2.4
*** main.c	1996/10/11 01:50:34	1.1.1.3.2.3
--- main.c	1998/06/16 02:24:27	1.1.1.3.2.4
***************
*** 17,22 ****
--- 17,25 ----
  #include <sys/wait.h>
  #include <sys/errno.h>
  #include <net/if.h>
+ #if ( __FreeBSD__ >= 3 )
+ #include <net/if_dl.h>
+ #endif
  #include <net/route.h>
  
  #include <signal.h>
***************
*** 1146,1154 ****
--- 1149,1171 ----
  		bootaddr( ciface );
  	    }
  	} else {
+ #if ( __FreeBSD__ >= 3 )
+ 	    struct sockaddr_dl *dlp;
+ 
  	    /* configure multicast for this interface */
  	    bzero( &sa, sizeof( struct sockaddr ));
+ 	    dlp = (struct sockaddr_dl *)&sa;
+ 	    dlp->sdl_len = sizeof(struct sockaddr_dl);
+ 	    dlp->sdl_family = AF_LINK;
+ 	    dlp->sdl_index = 0;
+ 	    dlp->sdl_nlen = 0;
+ 	    dlp->sdl_alen = 6;
+ 	    dlp->sdl_slen = 0;
+ 	    bcopy (ethermulti, LLADDR(dlp), sizeof( ethermulti ));
+ #else
+ 	    bzero( &sa, sizeof( struct sockaddr ));
  	    bcopy( ethermulti, sa.sa_data, sizeof( ethermulti ));
+ #endif
  	    if ( ifconfig( iface->i_name, SIOCADDMULTI, &sa )) {
  		syslog( LOG_ERR, "addmulti: %m" );
  		exit( 1 );

--------------3F54BC7E1CFBAE3959E2B600--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3585D9A8.15FB7483>