Skip to contentSkip to conversation

net: fix vlan validation

PATCH In review Stefan Agner 4 participants 9 messages Apr 13, 2016 – May 3, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net: fix vlan validation

VLAN identifiers are 12-bit decimal numbers, not IP addresses.

---

 include/env_flags.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/env_flags.h +2 -2
index 9e87e1b..0dcec06 100644
@@ -57,8 +57,8 @@ enum env_flags_varaccess {
 	"gatewayip:i," \
 	"netmask:i," \
 	"serverip:i," \
-	"nvlan:i," \
-	"vlan:i," \
+	"nvlan:d," \
+	"vlan:d," \
 	"dnsip:i,"
 #else
 #define ETHADDR_FLAGS
Signature · 1 line
2.8.0
#1 lore raw

PATCH 2/2 net: increase maximum frame size to accomediate VLAN packets

Ethernet packages with IEEE 802.1Q VLAN support may be up to 1522 bytes long. Increase the default size used to allocate packet storage by 4 bytes. While at it, let git care about history and rewrite the comment to represent the situation today only.

---

 include/net.h | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
include/net.h +5 -11
index 1fb4194..05800c4 100644
@@ -465,20 +465,14 @@ struct icmp_hdr {
 #define IP_ICMP_HDR_SIZE	(IP_HDR_SIZE + ICMP_HDR_SIZE)
 
 /*
- * Maximum packet size; used to allocate packet storage.
- * TFTP packets can be 524 bytes + IP header + ethernet header.
- * Lets be conservative, and go for 38 * 16.  (Must also be
- * a multiple of 32 bytes).
- */
-/*
- * AS.HARNOIS : Better to set PKTSIZE to maximum size because
- * traffic type is not always controlled
- * maximum packet size =  1518
+ * Maximum packet size; used to allocate packet storage. Use
+ * the maxium Ethernet frame size as specified by the Ethernet
+ * standard including the 802.1Q tag (VLAN tagging).
+ * maximum packet size =  1522
  * maximum packet size and multiple of 32 bytes =  1536
  */
-#define PKTSIZE			1518
+#define PKTSIZE			1522
 #define PKTSIZE_ALIGN		1536
-/*#define PKTSIZE		608*/
 
 /*
  * Maximum receive ring size; that is, the number of packets
Signature · 1 line
2.8.0
#2 lore raw

PATCH 2/2 net: increase maximum frame size to accomediate VLAN packets

Hi Tom,

Sorry, I accidentally didn't add the v2 in the Subject...

On 2016-04-13 16:38, Stefan Agner wrote:
...

Quoted 10 lines

/*
- * Maximum packet size; used to allocate packet storage.
- * TFTP packets can be 524 bytes + IP header + ethernet header.
- * Lets be conservative, and go for 38 * 16. (Must also be
- * a multiple of 32 bytes).
- */

include/net.h +0 -4
-/*
- * AS.HARNOIS : Better to set PKTSIZE to maximum size because
- * traffic type is not always controlled
- * maximum packet size =  1518

include/net.h struct icmp_hdr { · line 481

Quoted 10 lines
include/net.h +5 -2
+ * Maximum packet size; used to allocate packet storage. Use
+ * the maxium Ethernet frame size as specified by the Ethernet
+ * standard including the 802.1Q tag (VLAN tagging).
+ * maximum packet size =  1522
  * maximum packet size and multiple of 32 bytes =  1536
  */
-#define PKTSIZE			1518
+#define PKTSIZE			1522
 #define PKTSIZE_ALIGN		1536
-/*#define PKTSIZE		608*/

I rewrote the whole comment, as I felt it does not make sense to keep history in the source file. Hope this is ok for you.

--
Stefan

#3 lore raw

PATCH 2/2 net: increase maximum frame size to accomediate VLAN packets

In reply to Stefan Agner
Quoted 6 lines · Stefan Agner

Ethernet packages with IEEE 802.1Q VLAN support may be up to 1522 bytes long. Increase the default size used to allocate packet storage by 4 bytes. While at it, let git care about history and rewrite the comment to represent the situation today only.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160415/9d012038/attachment.sig>
#4 lore raw

PATCH 2/2 net: increase maximum frame size to accomediate VLAN packets

In reply to Stefan Agner
Quoted 6 lines · Stefan Agner

Ethernet packages with IEEE 802.1Q VLAN support may be up to 1522 bytes long. Increase the default size used to allocate packet storage by 4 bytes. While at it, let git care about history and rewrite the comment to represent the situation today only.

#6 lore raw

PATCH 1/2 net: fix vlan validation

In reply to Stefan Agner
Quoted 3 lines · Stefan Agner

VLAN identifiers are 12-bit decimal numbers, not IP addresses.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160415/1340745d/attachment.sig>