Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jul 1996 18:02:13 -0700 (PDT)
From:      "JULIAN Elischer" <julian@ref.tfs.com>
To:        spfarrel@midway.uchicago.edu (steve farrell)
Cc:        hackers@freebsd.org
Subject:   Re: netatalk [extra patch]
Message-ID:  <199607190102.SAA21103@ref.tfs.com>
In-Reply-To: <199607182126.QAA26476@meno.uchicago.edu> from "steve farrell" at Jul 18, 96 04:26:13 pm

next in thread | previous in thread | raw e-mail | index | archive | help
If anyone is trying to use netatalk with freebsd using the generally available
patches..
note that there seem to be two different sets of 
patches floating around to make netatalk work with FreeBSD..
I think that both require some version of this fix.

they will need the following patch also:

WARNING, apply this fix BY HAND, after already applying
the standard freebsd patches. (whichever set you can find)



Index: config.c
===================================================================
RCS file: /cvs/mod/umich/netatalk/etc/atalkd/config.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 config.c
*** 1.1.1.1	1996/05/22 22:42:21
--- config.c	1996/07/19 00:46:14
***************
*** 445,453 ****
  		ntohs( iface->i_rt->rt_lastnet ) <
  		ntohs( iface->i_caddr.sat_addr.s_net )) {
  	    fprintf( stderr, "Net (%u) not in net-range (%u-%u).\n",
- 		    ntohs( iface->i_caddr.sat_addr.s_net ),
  		    ntohs( iface->i_rt->rt_firstnet ),
! 		    ntohs( iface->i_rt->rt_lastnet ));
  	    exit( 1 );
  	}
      } else {
--- 445,453 ----
  		ntohs( iface->i_rt->rt_lastnet ) <
  		ntohs( iface->i_caddr.sat_addr.s_net )) {
  	    fprintf( stderr, "Net (%u) not in net-range (%u-%u).\n",
  		    ntohs( iface->i_rt->rt_firstnet ),
! 		    ntohs( iface->i_rt->rt_lastnet ),
! 		    ntohs( iface->i_caddr.sat_addr.s_net ));
  	    exit( 1 );
  	}
      } else {
***************
*** 506,515 ****
  getifconf()
  {
      struct ifconf	ifc;
!     struct ifreq	ifrs[ 10 ], *ifr;
      struct interface	*iface, *niface;
      int			s;
  
      if (( s = socket( AF_APPLETALK, SOCK_DGRAM, 0 )) < 0 ) {
  	perror( "socket" );
  	exit( 1 );
--- 506,519 ----
  getifconf()
  {
      struct ifconf	ifc;
!     struct ifreq	ifrs[ 64 ], *ifr, *nextifr;
      struct interface	*iface, *niface;
      int			s;
+     struct sockaddr 	*sa_p;
+     int	ifrsize = 0;
  
+     bzero(&ifc,sizeof(struct ifconf));
+     bzero(ifrs,sizeof(struct ifreq) * 64);
      if (( s = socket( AF_APPLETALK, SOCK_DGRAM, 0 )) < 0 ) {
  	perror( "socket" );
  	exit( 1 );
***************
*** 518,529 ****
      ifc.ifc_len = sizeof( ifrs );
      ifc.ifc_buf = (caddr_t)ifrs;
      if ( ioctl( s, SIOCGIFCONF, &ifc ) < 0 ) {
! 	perror( "gifconf" );
  	exit( 1 );
      }
  
      for ( ifr = ifc.ifc_req; ifc.ifc_len >= sizeof( struct ifreq );
! 	    ifc.ifc_len -= sizeof( struct ifreq ), ifr++ ) {
  	if ( ioctl( s, SIOCGIFFLAGS, ifr ) < 0 ) {
  	    perror( ifr->ifr_name );
  	    exit( 1 );
--- 522,546 ----
      ifc.ifc_len = sizeof( ifrs );
      ifc.ifc_buf = (caddr_t)ifrs;
      if ( ioctl( s, SIOCGIFCONF, &ifc ) < 0 ) {
! 	perror( "getifconf" );
  	exit( 1 );
      }
  
      for ( ifr = ifc.ifc_req; ifc.ifc_len >= sizeof( struct ifreq );
! 			ifr = nextifr, ifc.ifc_len -= ifrsize) {
! 	/*
! 	 * in BSD4.4, this returns an entry for every address
! 	 * Associated with the if. including physical.. they
! 	 * include a sockaddr which is VARIABLE LENGTH!
! 	 * 
! 	 * Calculate the length of this entry.
! 	 */
! 	sa_p = &(ifr->ifr_addr);
! 	ifrsize =  IFNAMSIZ + sa_p->sa_len;
! 	nextifr = (struct ifreq *)((caddr_t)ifr + ifrsize);
! 	/*
! 	 * Now get it's flags
! 	 */
  	if ( ioctl( s, SIOCGIFFLAGS, ifr ) < 0 ) {
  	    perror( ifr->ifr_name );
  	    exit( 1 );
***************
*** 585,593 ****
--- 602,616 ----
      strcpy( niface->i_name, name );
      niface->i_flags = 0;
      niface->i_time = 0;
+ #ifdef BSD4_4
+     niface->i_addr.sat_len = sizeof(struct sockaddr_at);
+ #endif BSD4_4
      niface->i_addr.sat_family = AF_APPLETALK;
      niface->i_addr.sat_addr.s_net = htons( ATADDR_ANYNET );
      niface->i_addr.sat_addr.s_node = ATADDR_ANYNODE;
+ #ifdef BSD4_4
+     niface->i_caddr.sat_len = sizeof(struct sockaddr_at);
+ #endif BSD4_4
      niface->i_caddr.sat_family = AF_APPLETALK;
      niface->i_caddr.sat_addr.s_net = htons( ATADDR_ANYNET );
      niface->i_caddr.sat_addr.s_node = ATADDR_ANYNODE;
> 
> >
> >The netatalk daemon atalkd needs a patch..
> >I'll send it later..
> 
> cool.
> 
> >to avoid hte broken code, you can supply a configuration file..
> >the broken code is in teh auto-config code, so if it
> >is controlled by a config file, this doesn't happen..
> 
> ... do you mean the patch is for the autoconfig, or that
> running autoconfig will break something else besides what
> the patch fixes?
> 
> (i guess that'll become clear to me when i see the patch =)
> 
> >
> >julian
> 
> thanks - steve farrell
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607190102.SAA21103>