Skip to contentSkip to conversation

net/ethernet/eth.c - eth_header

PATCH In review Vicente Feito 3 participants 5 messages Mar 23, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ethernet/eth.c - eth_header

Hi,
Please consider applying (or droping).
Thank you.

Description: This patch prevent drivers from calling eth_header with a 802.3 frame using a len>1536. In such a case returns -EINVAL, which was hard to choose because the ETH_HLEN is supposed to return.

net/ethernet/eth.c renamed from net/ethernet/eth.c.orig +2 -0
@@ -78,6 +78,8 @@ int eth_header(struct sk_buff *skb, stru
 {
 	struct ethhdr *eth = (struct ethhdr *)skb_push(skb,ETH_HLEN);
 
+	if (type == ETH_P_802_3 && len >= 1536)
+		return -EINVAL;
 	/* 
 	 *	Set the protocol type. For a packet of type ETH_P_802_3 we put the length
 	 *	in here instead. It is up to the 802.2 layer to carry protocol information.
#1 lore raw
Quoted 16 lines · Vicente Feito

Hi,
Please consider applying (or droping).
Thank you.

Description: This patch prevent drivers from calling eth_header with a 802.3 frame using a len>1536. In such a case returns -EINVAL, which was hard to choose because the ETH_HLEN is supposed to return.

------------------------------------------------------------------------

net/ethernet/eth.c int eth_header(struct sk_buff *skb, stru · line 82

Quoted 5 lines
net/ethernet/eth.c renamed from net/ethernet/eth.c.orig +2 -0
@@ -78,6 +78,8 @@ int eth_header(struct sk_buff *skb, stru
 {
 	struct ethhdr *eth = (struct ethhdr *)skb_push(skb,ETH_HLEN);
 
+	if (type == ETH_P_802_3 && len >= 1536)
+		return -EINVAL;

Why? Won't this break for jumbo frames?

Jeff

#2 lore raw
Quoted 21 lines · Jeff Garzik
Quoted 20 lines · Vicente Feito

Hi,
Please consider applying (or droping).
Thank you.

Description: This patch prevent drivers from calling eth_header with a 802.3 frame using a len>1536. In such a case returns -EINVAL, which was hard to choose because the ETH_HLEN is supposed to return.

------------------------------------------------------------------------

--- linux-2.6.12-rc1-mm1/net/ethernet/eth.c.orig 2005-03-22 12:49:08.000000000 +0000 +++ linux-2.6.12-rc1-mm1/net/ethernet/eth.c 2005-03-22 12:49:36.000000000 +0000 @@ -78,6 +78,8 @@ int eth_header(struct sk_buff *skb, stru
{
struct ethhdr *eth = (struct ethhdr *)skb_push(skb,ETH_HLEN);

Quoted 6 lines
Quoted 2 lines

+ if (type == ETH_P_802_3 && len >= 1536)
+ return -EINVAL;

Why? Won't this break for jumbo frames?

Jeff

True, I completely forgot about it, I was having problems with a driver and I though this would be a correct approach for size violation avoidance, but I guess it doesn't have much sense to change len >= 1536 by the 9000 of a jumbo packet, sorry.

Vicente

#3 lore raw
Quoted 26 lines · Vicente Feito
Quoted 25 lines · Jeff Garzik
Quoted 23 lines · Vicente Feito

Hi,
Please consider applying (or droping).
Thank you.

Description: This patch prevent drivers from calling eth_header with a 802.3 frame using a len>1536. In such a case returns -EINVAL, which was hard to choose because the ETH_HLEN is supposed to return.

-----------------------------------------------------------------------
-

--- linux-2.6.12-rc1-mm1/net/ethernet/eth.c.orig 2005-03-22 12:49:08.000000000 +0000 +++ linux-2.6.12-rc1-mm1/net/ethernet/eth.c 2005-03-22 12:49:36.000000000 +0000 @@ -78,6 +78,8 @@ int eth_header(struct sk_buff *skb, stru
{
struct ethhdr *eth = (struct ethhdr *)skb_push(skb,ETH_HLEN);

+ if (type == ETH_P_802_3 && len >= 1536)
+ return -EINVAL;

Quoted 8 lines
Quoted 3 lines

Why? Won't this break for jumbo frames?

Jeff

True, I completely forgot about it, I was having problems with a driver and I though this would be a correct approach for size violation avoidance, but I guess it doesn't have much sense to change len >= 1536 by the 9000 of a jumbo packet, sorry.

Jumbo Frames can be upto 16k.

Signature · 2 lines
Jon Mason
[email protected]
#4 lore raw
In reply to Vicente Feito
Quoted 7 lines · Vicente Feito

Hi,
Please consider applying (or droping).
Thank you.

Description: This patch prevent drivers from calling eth_header with a 802.3 frame using a len>1536. In such a case returns -EINVAL, which was hard to choose because the ETH_HLEN is supposed to return.

Won't this break jumbo frames?

Signature · 2 lines
Jon Mason
[email protected]