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 /net | |
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>
Diffstat (limited to 'net')
-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 |
8 files changed, 10 insertions, 10 deletions
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; | 140 | return proto; |
141 | 141 | ||
142 | if (get_unaligned((__be16 *) skb->data) == htons(0xFFFF)) | 142 | if (get_unaligned((__be16 *) skb->data) == htons(0xFFFF)) |
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 8d493c91a562..3d110c4fc787 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -138,7 +138,7 @@ ebt_basic_match(const struct ebt_entry *e, const struct sk_buff *skb, | |||
138 | ethproto = h->h_proto; | 138 | ethproto = h->h_proto; |
139 | 139 | ||
140 | if (e->bitmask & EBT_802_3) { | 140 | if (e->bitmask & EBT_802_3) { |
141 | if (FWINV2(ntohs(ethproto) >= 1536, EBT_IPROTO)) | 141 | if (FWINV2(ntohs(ethproto) >= ETH_P_802_3_MIN, EBT_IPROTO)) |
142 | return 1; | 142 | return 1; |
143 | } else if (!(e->bitmask & EBT_NOPROTO) && | 143 | } else if (!(e->bitmask & EBT_NOPROTO) && |
144 | FWINV2(e->ethproto != ethproto, EBT_IPROTO)) | 144 | FWINV2(e->ethproto != ethproto, EBT_IPROTO)) |
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index a36c85eab5b4..5359560926bc 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c | |||
@@ -195,7 +195,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
195 | if (netdev_uses_trailer_tags(dev)) | 195 | if (netdev_uses_trailer_tags(dev)) |
196 | return htons(ETH_P_TRAILER); | 196 | return htons(ETH_P_TRAILER); |
197 | 197 | ||
198 | if (ntohs(eth->h_proto) >= 1536) | 198 | if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN) |
199 | return eth->h_proto; | 199 | return eth->h_proto; |
200 | 200 | ||
201 | /* | 201 | /* |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 8914d2d2881a..4e8a86163fc7 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -2085,7 +2085,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
2085 | encaps_data = bridge_tunnel_header; | 2085 | encaps_data = bridge_tunnel_header; |
2086 | encaps_len = sizeof(bridge_tunnel_header); | 2086 | encaps_len = sizeof(bridge_tunnel_header); |
2087 | skip_header_bytes -= 2; | 2087 | skip_header_bytes -= 2; |
2088 | } else if (ethertype >= 0x600) { | 2088 | } else if (ethertype >= ETH_P_802_3_MIN) { |
2089 | encaps_data = rfc1042_header; | 2089 | encaps_data = rfc1042_header; |
2090 | encaps_len = sizeof(rfc1042_header); | 2090 | encaps_len = sizeof(rfc1042_header); |
2091 | skip_header_bytes -= 2; | 2091 | skip_header_bytes -= 2; |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index d61cd9971808..8759265a3e46 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -681,7 +681,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info) | |||
681 | /* Normally, setting the skb 'protocol' field would be handled by a | 681 | /* Normally, setting the skb 'protocol' field would be handled by a |
682 | * call to eth_type_trans(), but it assumes there's a sending | 682 | * call to eth_type_trans(), but it assumes there's a sending |
683 | * device, which we may not have. */ | 683 | * device, which we may not have. */ |
684 | if (ntohs(eth->h_proto) >= 1536) | 684 | if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN) |
685 | packet->protocol = eth->h_proto; | 685 | packet->protocol = eth->h_proto; |
686 | else | 686 | else |
687 | packet->protocol = htons(ETH_P_802_2); | 687 | packet->protocol = htons(ETH_P_802_2); |
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index fe0e4215c73d..332486839347 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
@@ -466,7 +466,7 @@ static __be16 parse_ethertype(struct sk_buff *skb) | |||
466 | proto = *(__be16 *) skb->data; | 466 | proto = *(__be16 *) skb->data; |
467 | __skb_pull(skb, sizeof(__be16)); | 467 | __skb_pull(skb, sizeof(__be16)); |
468 | 468 | ||
469 | if (ntohs(proto) >= 1536) | 469 | if (ntohs(proto) >= ETH_P_802_3_MIN) |
470 | return proto; | 470 | return proto; |
471 | 471 | ||
472 | if (skb->len < sizeof(struct llc_snap_hdr)) | 472 | if (skb->len < sizeof(struct llc_snap_hdr)) |
@@ -483,7 +483,7 @@ static __be16 parse_ethertype(struct sk_buff *skb) | |||
483 | 483 | ||
484 | __skb_pull(skb, sizeof(struct llc_snap_hdr)); | 484 | __skb_pull(skb, sizeof(struct llc_snap_hdr)); |
485 | 485 | ||
486 | if (ntohs(llc->ethertype) >= 1536) | 486 | if (ntohs(llc->ethertype) >= ETH_P_802_3_MIN) |
487 | return llc->ethertype; | 487 | return llc->ethertype; |
488 | 488 | ||
489 | return htons(ETH_P_802_2); | 489 | return htons(ETH_P_802_2); |
@@ -1038,7 +1038,7 @@ int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp, | |||
1038 | 1038 | ||
1039 | if (attrs & (1 << OVS_KEY_ATTR_ETHERTYPE)) { | 1039 | if (attrs & (1 << OVS_KEY_ATTR_ETHERTYPE)) { |
1040 | swkey->eth.type = nla_get_be16(a[OVS_KEY_ATTR_ETHERTYPE]); | 1040 | swkey->eth.type = nla_get_be16(a[OVS_KEY_ATTR_ETHERTYPE]); |
1041 | if (ntohs(swkey->eth.type) < 1536) | 1041 | if (ntohs(swkey->eth.type) < ETH_P_802_3_MIN) |
1042 | return -EINVAL; | 1042 | return -EINVAL; |
1043 | attrs &= ~(1 << OVS_KEY_ATTR_ETHERTYPE); | 1043 | attrs &= ~(1 << OVS_KEY_ATTR_ETHERTYPE); |
1044 | } else { | 1044 | } else { |
diff --git a/net/wireless/util.c b/net/wireless/util.c index 37a56ee1e1ed..6cbac99ae03d 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -511,7 +511,7 @@ int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, | |||
511 | encaps_data = bridge_tunnel_header; | 511 | encaps_data = bridge_tunnel_header; |
512 | encaps_len = sizeof(bridge_tunnel_header); | 512 | encaps_len = sizeof(bridge_tunnel_header); |
513 | skip_header_bytes -= 2; | 513 | skip_header_bytes -= 2; |
514 | } else if (ethertype > 0x600) { | 514 | } else if (ethertype >= ETH_P_802_3_MIN) { |
515 | encaps_data = rfc1042_header; | 515 | encaps_data = rfc1042_header; |
516 | encaps_len = sizeof(rfc1042_header); | 516 | encaps_len = sizeof(rfc1042_header); |
517 | skip_header_bytes -= 2; | 517 | skip_header_bytes -= 2; |