GARP protocol should not send PDUs larger than MTU
PATCH 1/1 GARP protocol should not send PDUs larger than MTU
If a network interface has many vlan sub-interfaces (~400 or more) with enabled GVRP, PDUs may become larger than the interface PDU. GARP packet generator can send multiple PDUs, but it relies heavily on skb_tailroom() not exceeding maximal packet size.
Patch to fix this issue is proposed, I'm not sure if it's a correct way to handle this situation, but after a short test looks like it works - now I get multiple PDUs with maximum size of a 1514 bytes (1500 MTU) and switch recognizes them now.
MRP protocol can have the same problem, but I can't test it.
Signed-off-by Vitaly V. Bursov <[email protected]>
net/802/garp.c +8 -0
@@ -210,6 +210,7 @@ {struct sk_buff *skb;struct garp_pdu_hdr *gp; +int extra_size;#define LLC_RESERVE sizeof(struct llc_pdu_un) skb = alloc_skb(app->dev->mtu + LL_RESERVED_SPACE(app->dev),
@@ -221,6 +222,13 @@ skb->protocol =htons (ETH_P_802_2 );skb_reserve (skb,LL_RESERVED_SPACE (app->dev) +LLC_RESERVE ); +/* Reserve extra space to avoid PDUs larger than MTU, +* Other code depends on skb_tailroom() to return exact +* usable packet space left */ + extra_size =skb_tailroom (skb) - (app->dev->mtu -LLC_RESERVE ); +if (extra_size >0 ) +skb_reserve (skb, extra_size); + gp = (struct garp_pdu_hdr *)__skb_put (skb,sizeof (*gp));put_unaligned (htons (GARP_PROTOCOL_ID ), &gp->protocol);