mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] GARP protocol should not send PDUs larger than MTU
@ 2014-01-13 11:54 Vitaly V. Bursov
  0 siblings, 0 replies; only message in thread
From: Vitaly V. Bursov @ 2014-01-13 11:54 UTC (permalink / raw)
  To: linux-kernel

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 <vitalyb@telenet.dn.ua>

--- a/net/802/garp.c	2014-01-13 12:55:07.000000000 +0200
+++ b/net/802/garp.c	2014-01-13 12:58:30.000000000 +0200
@@ -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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-01-13 12:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-13 11:54 [PATCH] GARP protocol should not send PDUs larger than MTU Vitaly V. Bursov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®