netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vlan: Make it possible to add vlan with id 4095
@ 2012-09-28 12:32 Paulius Zaleckas
  2012-09-28 13:29 ` Paulius Zaleckas
  2012-09-28 17:44 ` David Miller
  0 siblings, 2 replies; 7+ messages in thread
From: Paulius Zaleckas @ 2012-09-28 12:32 UTC (permalink / raw)
  To: kaber, netdev

vconfig help tells that vlan_id should be 0-4095, but fails
with 4095.

There is an off-by-one bug while evaluating vlan_id.
Fix it by evaluating against count(4096), not mask(0x0fff = 4095).

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
---

 net/8021q/vlan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 9096bcb..9e528bf 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -199,7 +199,7 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
 	char name[IFNAMSIZ];
 	int err;
 
-	if (vlan_id >= VLAN_VID_MASK)
+	if (vlan_id >= VLAN_N_VID)
 		return -ERANGE;
 
 	err = vlan_check_real_dev(real_dev, vlan_id);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] vlan: Make it possible to add vlan with id 4095
  2012-09-28 12:32 [PATCH] vlan: Make it possible to add vlan with id 4095 Paulius Zaleckas
@ 2012-09-28 13:29 ` Paulius Zaleckas
  2012-09-28 17:44 ` David Miller
  1 sibling, 0 replies; 7+ messages in thread
From: Paulius Zaleckas @ 2012-09-28 13:29 UTC (permalink / raw)
  To: kaber, netdev

On 09/28/2012 03:32 PM, Paulius Zaleckas wrote:
> vconfig help tells that vlan_id should be 0-4095, but fails
> with 4095.
>
> There is an off-by-one bug while evaluating vlan_id.
> Fix it by evaluating against count(4096), not mask(0x0fff = 4095).

On the other hand 4095 is reserved by 802.1Q...

http://en.wikipedia.org/wiki/IEEE_802.1Q
VLAN Identifier (VID): a 12-bit field specifying the VLAN to which the 
frame belongs. The hexadecimal values of 0x000 and 0xFFF are reserved. 
All other values may be used as VLAN identifiers, allowing up to 4,094 
VLANs. The reserved value 0x000 indicates that the frame does not belong 
to any VLAN; in this case, the 802.1Q tag specifies only a priority and 
is referred to as a priority tag.

So maybe we should fix vconfig help?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vlan: Make it possible to add vlan with id 4095
  2012-09-28 12:32 [PATCH] vlan: Make it possible to add vlan with id 4095 Paulius Zaleckas
  2012-09-28 13:29 ` Paulius Zaleckas
@ 2012-09-28 17:44 ` David Miller
  2012-09-28 17:55   ` Eric Dumazet
  2012-11-12 18:42   ` Jan Engelhardt
  1 sibling, 2 replies; 7+ messages in thread
From: David Miller @ 2012-09-28 17:44 UTC (permalink / raw)
  To: paulius.zaleckas; +Cc: kaber, netdev

From: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Date: Fri, 28 Sep 2012 15:32:58 +0300

> vconfig help tells that vlan_id should be 0-4095, but fails
> with 4095.
> 
> There is an off-by-one bug while evaluating vlan_id.
> Fix it by evaluating against count(4096), not mask(0x0fff = 4095).
> 
> Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>

Awesome, we don't need VXVLAN any more after this fix.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vlan: Make it possible to add vlan with id 4095
  2012-09-28 17:44 ` David Miller
@ 2012-09-28 17:55   ` Eric Dumazet
  2012-11-12 18:42   ` Jan Engelhardt
  1 sibling, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2012-09-28 17:55 UTC (permalink / raw)
  To: David Miller; +Cc: paulius.zaleckas, kaber, netdev

On Fri, 2012-09-28 at 13:44 -0400, David Miller wrote:

> 
> Awesome, we don't need VXVLAN any more after this fix.

Hey, I guess you meant to send this to G+, not netdev ;)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vlan: Make it possible to add vlan with id 4095
  2012-09-28 17:44 ` David Miller
  2012-09-28 17:55   ` Eric Dumazet
@ 2012-11-12 18:42   ` Jan Engelhardt
  2012-11-12 19:01     ` Ben Greear
  1 sibling, 1 reply; 7+ messages in thread
From: Jan Engelhardt @ 2012-11-12 18:42 UTC (permalink / raw)
  To: David Miller; +Cc: paulius.zaleckas, kaber, netdev

On Friday 2012-09-28 19:44, David Miller wrote:

>From: Paulius Zaleckas <paulius.zaleckas@gmail.com>
>Date: Fri, 28 Sep 2012 15:32:58 +0300
>
>> vconfig help tells that vlan_id should be 0-4095, but fails
>> with 4095.
>> 
>> There is an off-by-one bug while evaluating vlan_id.
>> Fix it by evaluating against count(4096), not mask(0x0fff = 4095).
>> 
>> Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
>
>Awesome, we don't need VXVLAN any more after this fix.

You mean because the special 0xfff value could indicate "here's more 
headers"? Sounds like a plan.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vlan: Make it possible to add vlan with id 4095
  2012-11-12 18:42   ` Jan Engelhardt
@ 2012-11-12 19:01     ` Ben Greear
  2012-11-12 20:37       ` Jan Engelhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Ben Greear @ 2012-11-12 19:01 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: David Miller, paulius.zaleckas, kaber, netdev

On 11/12/2012 10:42 AM, Jan Engelhardt wrote:
> On Friday 2012-09-28 19:44, David Miller wrote:
>
>> From: Paulius Zaleckas <paulius.zaleckas@gmail.com>
>> Date: Fri, 28 Sep 2012 15:32:58 +0300
>>
>>> vconfig help tells that vlan_id should be 0-4095, but fails
>>> with 4095.
>>>
>>> There is an off-by-one bug while evaluating vlan_id.
>>> Fix it by evaluating against count(4096), not mask(0x0fff = 4095).
>>>
>>> Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
>>
>> Awesome, we don't need VXVLAN any more after this fix.
>
> You mean because the special 0xfff value could indicate "here's more
> headers"? Sounds like a plan.

You can't just use reserved values...they are for the standards writers
in case they ever need to officially extend the 802.1q spec somehow.

If you use it for non-standard purposes, you can set up conflicts with
future standards.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vlan: Make it possible to add vlan with id 4095
  2012-11-12 19:01     ` Ben Greear
@ 2012-11-12 20:37       ` Jan Engelhardt
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Engelhardt @ 2012-11-12 20:37 UTC (permalink / raw)
  To: Ben Greear; +Cc: David Miller, paulius.zaleckas, kaber, netdev


On Monday 2012-11-12 20:01, Ben Greear wrote:
>>>
>>> Awesome, we don't need VXVLAN any more after this fix.
>>
>> You mean because the special 0xfff value could indicate "here's more
>> headers"? Sounds like a plan.
>
> You can't just use reserved values...

Indeed not; I was just implicitly thinking of the 802.1Q standard
comittee getting an impetus from the public disgust against VXVLAN to
define 0xfff with extensions that allow for e.g. stacking, making
VXVLAN redundant and obsolete. :)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-11-12 20:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-28 12:32 [PATCH] vlan: Make it possible to add vlan with id 4095 Paulius Zaleckas
2012-09-28 13:29 ` Paulius Zaleckas
2012-09-28 17:44 ` David Miller
2012-09-28 17:55   ` Eric Dumazet
2012-11-12 18:42   ` Jan Engelhardt
2012-11-12 19:01     ` Ben Greear
2012-11-12 20:37       ` Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).