patch-1.3.73 linux/net/appletalk/ddp.c

Next file: linux/net/ax25/af_ax25.c
Previous file: linux/net/appletalk/aarp.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.72/linux/net/appletalk/ddp.c linux/net/appletalk/ddp.c
@@ -19,6 +19,7 @@
  *		Alan Cox		:	Added firewall hooks.
  *		Alan Cox		:	Supports new ARPHRD_LOOPBACK
  *		Christer Weinigel	: 	Routing and /proc fixes.
+ *		Bradford Johnson	:	Locatalk.
  *
  *		This program is free software; you can redistribute it and/or
  *		modify it under the terms of the GNU General Public License
@@ -348,7 +349,38 @@
 	int netct;
 	int nodect;
 	
-	
+	struct ifreq atreq;
+	struct sockaddr_at *sa;
+	int err;
+
+/*
+ *	THIS IS A HACK: Farallon cards want to do their own picking of
+ *	addresses. This needs tidying up post 1.4, but we need it in 
+ *	now for the 1.4 release as is.
+ *
+ */
+	if(atif->dev->type == ARPHRD_LOCALTLK &&
+		atif->dev->do_ioctl) 
+	{
+		/* fake up the request and pass it down */
+		sa = (struct sockaddr_at*)&atreq.ifr_addr;
+		sa->sat_addr.s_node = probe_node;
+        	sa->sat_addr.s_net = probe_net;
+		if (!(err=atif->dev->do_ioctl(atif->dev,&atreq,SIOCSIFADDR)))
+		{
+			(void)atif->dev->do_ioctl(atif->dev,&atreq,SIOCGIFADDR);
+			atif->address.s_net=htons(sa->sat_addr.s_net);
+			atif->address.s_node=sa->sat_addr.s_node;
+			return 0;
+		}
+		/*
+		 *	If it didnt like our faked request then fail:
+		 *	This should check against -ENOIOCTLCMD and fall
+		 *	through. That needs us to fix all the devices up
+		 *	properly. We can then also dump the localtalk test.
+		 */
+		return err;
+	}	
 	/*
 	 *	Offset the network we start probing with.
 	 */
@@ -1597,6 +1629,7 @@
 						   if we slip up later */
 		*((__u16 *)ddp)=htons(*((__u16 *)ddp));		/* Mend the byte order */
 	}
+	skb->h.raw = skb->data;
 	return atalk_rcv(skb,dev,pt);
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this