diff options
| author | Simon Horman <horms@verge.net.au> | 2013-03-28 00:38:25 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2013-03-28 01:20:42 -0400 |
| commit | e5c5d22e8dcf7c2d430336cbf8e180bd38e8daf1 (patch) | |
| tree | 085634668082dc359bad9ff504f725423e947bb8 | |
| parent | 8b49a4c75965ed157e21450d23dcadd6b27c1aa3 (diff) | |
net: add ETH_P_802_3_MIN
Add a new constant ETH_P_802_3_MIN, the minimum ethernet type for
an 802.3 frame. Frames with a lower value in the ethernet type field
are Ethernet II.
Also update all the users of this value that David Miller and
I could find to use the new constant.
Also correct a bug in util.c. The comparison with ETH_P_802_3_MIN
should be >= not >.
As suggested by Jesse Gross.
Compile tested only.
Cc: David Miller <davem@davemloft.net>
Cc: Jesse Gross <jesse@nicira.com>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Bart De Schuymer <bart.de.schuymer@pandora.be>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Cc: netfilter-devel@vger.kernel.org
Cc: bridge@lists.linux-foundation.org
Cc: linux-wireless@vger.kernel.org
Cc: linux1394-devel@lists.sourceforge.net
Cc: linux-media@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: dev@openvswitch.org
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/firewire/net.c | 2 | ||||
| -rw-r--r-- | drivers/isdn/i4l/isdn_net.c | 2 | ||||
| -rw-r--r-- | drivers/media/dvb-core/dvb_net.c | 10 | ||||
| -rw-r--r-- | drivers/net/ethernet/sun/niu.c | 2 | ||||
| -rw-r--r-- | drivers/net/plip/plip.c | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/ray_cs.c | 2 | ||||
| -rw-r--r-- | include/linux/if_vlan.h | 2 | ||||
| -rw-r--r-- | include/uapi/linux/if_ether.h | 3 | ||||
| -rw-r--r-- | net/atm/lec.h | 2 | ||||
| -rw-r--r-- | net/bluetooth/bnep/netdev.c | 2 | ||||
| -rw-r--r-- | net/bridge/netfilter/ebtables.c | 2 | ||||
| -rw-r--r-- | net/ethernet/eth.c | 2 | ||||
| -rw-r--r-- | net/mac80211/tx.c | 2 | ||||
| -rw-r--r-- | net/openvswitch/datapath.c | 2 | ||||
| -rw-r--r-- | net/openvswitch/flow.c | 6 | ||||
| -rw-r--r-- | net/wireless/util.c | 2 |
16 files changed, 24 insertions, 21 deletions
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 56796330a162..4d565365e476 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c | |||
| @@ -547,7 +547,7 @@ static int fwnet_finish_incoming_packet(struct net_device *net, | |||
| 547 | if (memcmp(eth->h_dest, net->dev_addr, net->addr_len)) | 547 | if (memcmp(eth->h_dest, net->dev_addr, net->addr_len)) |
| 548 | skb->pkt_type = PACKET_OTHERHOST; | 548 | skb->pkt_type = PACKET_OTHERHOST; |
| 549 | } | 549 | } |
| 550 | if (ntohs(eth->h_proto) >= 1536) { | 550 | if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN) { |
| 551 | protocol = eth->h_proto; | 551 | protocol = eth->h_proto; |
| 552 | } else { | 552 | } else { |
| 553 | rawp = (u16 *)skb->data; | 553 | rawp = (u16 *)skb->data; |
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index babc621a07fb..88d657dff474 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
| @@ -1385,7 +1385,7 @@ isdn_net_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
| 1385 | if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN)) | 1385 | if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN)) |
| 1386 | skb->pkt_type = PACKET_OTHERHOST; | 1386 | skb->pkt_type = PACKET_OTHERHOST; |
| 1387 | } | 1387 | } |
| 1388 | if (ntohs(eth->h_proto) >= 1536) | 1388 | if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN) |
| 1389 | return eth->h_proto; | 1389 | return eth->h_proto; |
| 1390 | 1390 | ||
| 1391 | rawp = skb->data; | 1391 | rawp = skb->data; |
diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c index 44225b186f6d..83a23afb13ab 100644 --- a/drivers/media/dvb-core/dvb_net.c +++ b/drivers/media/dvb-core/dvb_net.c | |||
| @@ -185,7 +185,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb, | |||
| 185 | skb->pkt_type=PACKET_MULTICAST; | 185 | skb->pkt_type=PACKET_MULTICAST; |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | if (ntohs(eth->h_proto) >= 1536) | 188 | if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN) |
| 189 | return eth->h_proto; | 189 | return eth->h_proto; |
| 190 | 190 | ||
| 191 | rawp = skb->data; | 191 | rawp = skb->data; |
| @@ -228,9 +228,9 @@ static int ule_test_sndu( struct dvb_net_priv *p ) | |||
| 228 | static int ule_bridged_sndu( struct dvb_net_priv *p ) | 228 | static int ule_bridged_sndu( struct dvb_net_priv *p ) |
| 229 | { | 229 | { |
| 230 | struct ethhdr *hdr = (struct ethhdr*) p->ule_next_hdr; | 230 | struct ethhdr *hdr = (struct ethhdr*) p->ule_next_hdr; |
| 231 | if(ntohs(hdr->h_proto) < 1536) { | 231 | if(ntohs(hdr->h_proto) < ETH_P_802_3_MIN) { |
| 232 | int framelen = p->ule_sndu_len - ((p->ule_next_hdr+sizeof(struct ethhdr)) - p->ule_skb->data); | 232 | int framelen = p->ule_sndu_len - ((p->ule_next_hdr+sizeof(struct ethhdr)) - p->ule_skb->data); |
| 233 | /* A frame Type < 1536 for a bridged frame, introduces a LLC Length field. */ | 233 | /* A frame Type < ETH_P_802_3_MIN for a bridged frame, introduces a LLC Length field. */ |
| 234 | if(framelen != ntohs(hdr->h_proto)) { | 234 | if(framelen != ntohs(hdr->h_proto)) { |
| 235 | return -1; | 235 | return -1; |
| 236 | } | 236 | } |
| @@ -320,7 +320,7 @@ static int handle_ule_extensions( struct dvb_net_priv *p ) | |||
| 320 | (int) p->ule_sndu_type, l, total_ext_len); | 320 | (int) p->ule_sndu_type, l, total_ext_len); |
| 321 | #endif | 321 | #endif |
| 322 | 322 | ||
| 323 | } while (p->ule_sndu_type < 1536); | 323 | } while (p->ule_sndu_type < ETH_P_802_3_MIN); |
| 324 | 324 | ||
| 325 | return total_ext_len; | 325 | return total_ext_len; |
| 326 | } | 326 | } |
| @@ -712,7 +712,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) | |||
| 712 | } | 712 | } |
| 713 | 713 | ||
| 714 | /* Handle ULE Extension Headers. */ | 714 | /* Handle ULE Extension Headers. */ |
| 715 | if (priv->ule_sndu_type < 1536) { | 715 | if (priv->ule_sndu_type < ETH_P_802_3_MIN) { |
| 716 | /* There is an extension header. Handle it accordingly. */ | 716 | /* There is an extension header. Handle it accordingly. */ |
| 717 | int l = handle_ule_extensions(priv); | 717 | int l = handle_ule_extensions(priv); |
| 718 | if (l < 0) { | 718 | if (l < 0) { |
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index e4c1c88e4c2a..95cff98d8a34 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c | |||
| @@ -6618,7 +6618,7 @@ static u64 niu_compute_tx_flags(struct sk_buff *skb, struct ethhdr *ehdr, | |||
| 6618 | (len << TXHDR_LEN_SHIFT) | | 6618 | (len << TXHDR_LEN_SHIFT) | |
| 6619 | ((l3off / 2) << TXHDR_L3START_SHIFT) | | 6619 | ((l3off / 2) << TXHDR_L3START_SHIFT) | |
| 6620 | (ihl << TXHDR_IHL_SHIFT) | | 6620 | (ihl << TXHDR_IHL_SHIFT) | |
| 6621 | ((eth_proto_inner < 1536) ? TXHDR_LLC : 0) | | 6621 | ((eth_proto_inner < ETH_P_802_3_MIN) ? TXHDR_LLC : 0) | |
| 6622 | ((eth_proto == ETH_P_8021Q) ? TXHDR_VLAN : 0) | | 6622 | ((eth_proto == ETH_P_8021Q) ? TXHDR_VLAN : 0) | |
| 6623 | (ipv6 ? TXHDR_IP_VER : 0) | | 6623 | (ipv6 ? TXHDR_IP_VER : 0) | |
| 6624 | csum_bits); | 6624 | csum_bits); |
diff --git a/drivers/net/plip/plip.c b/drivers/net/plip/plip.c index bed62d9c53c8..1f7bef90b467 100644 --- a/drivers/net/plip/plip.c +++ b/drivers/net/plip/plip.c | |||
| @@ -560,7 +560,7 @@ static __be16 plip_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
| 560 | * so don't forget to remove it. | 560 | * so don't forget to remove it. |
| 561 | */ | 561 | */ |
| 562 | 562 | ||
| 563 | if (ntohs(eth->h_proto) >= 1536) | 563 | if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN) |
| 564 | return eth->h_proto; | 564 | return eth->h_proto; |
| 565 | 565 | ||
| 566 | rawp = skb->data; | 566 | rawp = skb->data; |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 4775b5d172d5..ebada812b3a5 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
| @@ -953,7 +953,7 @@ static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx, | |||
| 953 | unsigned char *data, int len) | 953 | unsigned char *data, int len) |
| 954 | { | 954 | { |
| 955 | __be16 proto = ((struct ethhdr *)data)->h_proto; | 955 | __be16 proto = ((struct ethhdr *)data)->h_proto; |
| 956 | if (ntohs(proto) >= 1536) { /* DIX II ethernet frame */ | 956 | if (ntohs(proto) >= ETH_P_802_3_MIN) { /* DIX II ethernet frame */ |
| 957 | pr_debug("ray_cs translate_frame DIX II\n"); | 957 | pr_debug("ray_cs translate_frame DIX II\n"); |
| 958 | /* Copy LLC header to card buffer */ | 958 | /* Copy LLC header to card buffer */ |
| 959 | memcpy_toio(&ptx->var, eth2_llc, sizeof(eth2_llc)); | 959 | memcpy_toio(&ptx->var, eth2_llc, sizeof(eth2_llc)); |
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 218a3b686d90..70962f3fdb79 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
| @@ -339,7 +339,7 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb, | |||
| 339 | */ | 339 | */ |
| 340 | 340 | ||
| 341 | proto = vhdr->h_vlan_encapsulated_proto; | 341 | proto = vhdr->h_vlan_encapsulated_proto; |
| 342 | if (ntohs(proto) >= 1536) { | 342 | if (ntohs(proto) >= ETH_P_802_3_MIN) { |
| 343 | skb->protocol = proto; | 343 | skb->protocol = proto; |
| 344 | return; | 344 | return; |
| 345 | } | 345 | } |
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h index 798032d01112..ade07f1c491a 100644 --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h | |||
| @@ -94,6 +94,9 @@ | |||
| 94 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ | 94 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ |
| 95 | #define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ | 95 | #define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ |
| 96 | 96 | ||
| 97 | #define ETH_P_802_3_MIN 0x0600 /* If the value in the ethernet type is less than this value | ||
| 98 | * then the frame is Ethernet II. Else it is 802.3 */ | ||
| 99 | |||
| 97 | /* | 100 | /* |
| 98 | * Non DIX types. Won't clash for 1500 types. | 101 | * Non DIX types. Won't clash for 1500 types. |
| 99 | */ | 102 | */ |
diff --git a/net/atm/lec.h b/net/atm/lec.h index a86aff9a3c04..4149db1b7885 100644 --- a/net/atm/lec.h +++ b/net/atm/lec.h | |||
| @@ -58,7 +58,7 @@ struct lane2_ops { | |||
| 58 | * field in h_type field. Data follows immediately after header. | 58 | * field in h_type field. Data follows immediately after header. |
| 59 | * 2. LLC Data frames whose total length, including LLC field and data, | 59 | * 2. LLC Data frames whose total length, including LLC field and data, |
| 60 | * but not padding required to meet the minimum data frame length, | 60 | * but not padding required to meet the minimum data frame length, |
| 61 | * is less than 1536(0x0600) MUST be encoded by placing that length | 61 | * is less than ETH_P_802_3_MIN MUST be encoded by placing that length |
| 62 | * in the h_type field. The LLC field follows header immediately. | 62 | * in the h_type field. The LLC field follows header immediately. |
| 63 | * 3. LLC data frames longer than this maximum MUST be encoded by placing | 63 | * 3. LLC data frames longer than this maximum MUST be encoded by placing |
| 64 | * the value 0 in the h_type field. | 64 | * the value 0 in the h_type field. |
diff --git a/net/bluetooth/bnep/netdev.c b/net/bluetooth/bnep/netdev.c index e58c8b32589c..4b488ec26105 100644 --- a/net/bluetooth/bnep/netdev.c +++ b/net/bluetooth/bnep/netdev.c | |||
| @@ -136,7 +136,7 @@ static u16 bnep_net_eth_proto(struct sk_buff *skb) | |||
| 136 | struct ethhdr *eh = (void *) skb->data; | 136 | struct ethhdr *eh = (void *) skb->data; |
| 137 | u16 proto = ntohs(eh->h_proto); | 137 | u16 proto = ntohs(eh->h_proto); |
| 138 | 138 | ||
| 139 | if (proto >= 1536) | 139 | if (proto >= ETH_P_802_3_MIN) |
| 140 | return proto; | ||
