patch-2.0.24 linux/net/ipv4/arp.c
Next file: linux/net/ipv4/icmp.c
Previous file: linux/net/core/sock.c
Back to the patch index
Back to the overall index
- Lines: 133
- Date:
Wed Oct 30 03:42:42 1996
- Orig file:
v2.0.23/linux/net/ipv4/arp.c
- Orig date:
Tue Oct 8 21:20:14 1996
diff -u --recursive --new-file v2.0.23/linux/net/ipv4/arp.c linux/net/ipv4/arp.c
@@ -60,6 +60,7 @@
* Mike Shaver : /proc/sys/net/ipv4/arp_* support
* Stuart Cheshire : Metricom and grat arp fixes
* *** FOR 2.1 clean this up ***
+ * Lawrence V. Stefani: (08/12/96) Added FDDI support.
*/
/* RFC1122 Status:
@@ -86,6 +87,7 @@
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
+#include <linux/fddidevice.h>
#include <linux/if_arp.h>
#include <linux/trdevice.h>
#include <linux/skbuff.h>
@@ -1289,7 +1291,8 @@
return 1;
#ifdef CONFIG_IP_MULTICAST
case IS_MULTICAST:
- if(dev->type==ARPHRD_ETHER || dev->type==ARPHRD_IEEE802)
+ if(dev->type==ARPHRD_ETHER || dev->type==ARPHRD_IEEE802
+ || dev->type==ARPHRD_FDDI)
{
u32 taddr;
haddr[0]=0x01;
@@ -1702,11 +1705,23 @@
/*
* Fill the device header for the ARP frame
*/
-
dev->hard_header(skb,dev,ptype,dest_hw?dest_hw:dev->broadcast,src_hw?src_hw:NULL,skb->len);
- /* Fill out the arp protocol part. */
+ /*
+ * Fill out the arp protocol part.
+ *
+ * The arp hardware type should match the device type, except for FDDI,
+ * which (according to RFC 1390) should always equal 1 (Ethernet).
+ */
+#ifdef CONFIG_FDDI
+ arp->ar_hrd = (dev->type == ARPHRD_FDDI) ? htons(ARPHRD_ETHER) : htons(dev->type);
+#else
arp->ar_hrd = htons(dev->type);
+#endif
+ /*
+ * Exceptions everywhere. AX.25 uses the AX.25 PID value not the
+ * DIX code for the protocol. Make these device structure fields.
+ */
#ifdef CONFIG_AX25
#ifdef CONFIG_NETROM
arp->ar_pro = (dev->type == ARPHRD_AX25 || dev->type == ARPHRD_NETROM) ? htons(AX25_P_IP) : htons(ETH_P_IP);
@@ -1751,7 +1766,7 @@
unsigned char *arp_ptr= (unsigned char *)(arp+1);
unsigned char *sha,*tha;
u32 sip,tip;
-
+
/*
* The hardware length of the packet should match the hardware length
* of the device. Similarly, the hardware types should match. The
@@ -1759,16 +1774,44 @@
* is not from an IP number. We can't currently handle this, so toss
* it.
*/
+#ifdef CONFIG_FDDI
+ if (dev->type == ARPHRD_FDDI)
+ {
+ /*
+ * According to RFC 1390, FDDI devices should accept ARP hardware types
+ * of 1 (Ethernet). However, to be more robust, we'll accept hardware
+ * types of either 1 (Ethernet) or 6 (IEEE 802.2).
+ */
+ if (arp->ar_hln != dev->addr_len ||
+ ((ntohs(arp->ar_hrd) != ARPHRD_ETHER) && (ntohs(arp->ar_hrd) != ARPHRD_IEEE802)) ||
+ dev->flags & IFF_NOARP ||
+ arp->ar_pln != 4)
+ {
+ kfree_skb(skb, FREE_READ);
+ return 0;
+ }
+ }
+ else
+ {
+ if (arp->ar_hln != dev->addr_len ||
+ dev->type != ntohs(arp->ar_hrd) ||
+ dev->flags & IFF_NOARP ||
+ arp->ar_pln != 4)
+ {
+ kfree_skb(skb, FREE_READ);
+ return 0;
+ }
+ }
+#else
if (arp->ar_hln != dev->addr_len ||
- dev->type != ntohs(arp->ar_hrd) ||
+ dev->type != ntohs(arp->ar_hrd) ||
dev->flags & IFF_NOARP ||
arp->ar_pln != 4)
{
kfree_skb(skb, FREE_READ);
return 0;
- /* Should this be an error/printk? Seems like something */
- /* you'd want to know about. Unless it's just !IFF_NOARP. -- MS */
}
+#endif
/*
* Another test.
@@ -1776,7 +1819,6 @@
* match the protocol the device speaks. If it doesn't, there is a
* problem, so toss the packet.
*/
-/* Again, should this be an error/printk? -- MS */
switch (dev->type)
{
@@ -1801,14 +1843,8 @@
case ARPHRD_ETHER:
case ARPHRD_ARCNET:
case ARPHRD_METRICOM:
- if(arp->ar_pro != htons(ETH_P_IP))
- {
- kfree_skb(skb, FREE_READ);
- return 0;
- }
- break;
-
case ARPHRD_IEEE802:
+ case ARPHRD_FDDI:
if(arp->ar_pro != htons(ETH_P_IP))
{
kfree_skb(skb, FREE_READ);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov