-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GVRP support for dynamically registering VLANs with switches. By default GVRP is disabled because we only support the applicant-only participant model, which means it should not be enabled on vlans that are members of a bridge. Since there is currently no way to cleanly determine that, the user is responsible for enabling it. The code is pretty small and low impact, its wrapped in a config option though because it depends on the GARP implementation and the STP core. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Patrick McHardy
authored and
David S. Miller
committed
Jul 6, 2008
1 parent
ce30500
commit 70c03b4
Showing
9 changed files
with
134 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* IEEE 802.1Q GARP VLAN Registration Protocol (GVRP) | ||
* | ||
* Copyright (c) 2008 Patrick McHardy <kaber@trash.net> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* version 2 as published by the Free Software Foundation. | ||
*/ | ||
#include <linux/types.h> | ||
#include <linux/if_vlan.h> | ||
#include <net/garp.h> | ||
#include "vlan.h" | ||
|
||
#define GARP_GVRP_ADDRESS { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x21 } | ||
|
||
enum gvrp_attributes { | ||
GVRP_ATTR_INVALID, | ||
GVRP_ATTR_VID, | ||
__GVRP_ATTR_MAX | ||
}; | ||
#define GVRP_ATTR_MAX (__GVRP_ATTR_MAX - 1) | ||
|
||
static struct garp_application vlan_gvrp_app __read_mostly = { | ||
.proto.group_address = GARP_GVRP_ADDRESS, | ||
.maxattr = GVRP_ATTR_MAX, | ||
.type = GARP_APPLICATION_GVRP, | ||
}; | ||
|
||
int vlan_gvrp_request_join(const struct net_device *dev) | ||
{ | ||
const struct vlan_dev_info *vlan = vlan_dev_info(dev); | ||
__be16 vid = htons(vlan->vlan_id); | ||
|
||
return garp_request_join(vlan->real_dev, &vlan_gvrp_app, | ||
&vid, sizeof(vid), GVRP_ATTR_VID); | ||
} | ||
|
||
void vlan_gvrp_request_leave(const struct net_device *dev) | ||
{ | ||
const struct vlan_dev_info *vlan = vlan_dev_info(dev); | ||
__be16 vid = htons(vlan->vlan_id); | ||
|
||
garp_request_leave(vlan->real_dev, &vlan_gvrp_app, | ||
&vid, sizeof(vid), GVRP_ATTR_VID); | ||
} | ||
|
||
int vlan_gvrp_init_applicant(struct net_device *dev) | ||
{ | ||
return garp_init_applicant(dev, &vlan_gvrp_app); | ||
} | ||
|
||
void vlan_gvrp_uninit_applicant(struct net_device *dev) | ||
{ | ||
garp_uninit_applicant(dev, &vlan_gvrp_app); | ||
} | ||
|
||
int __init vlan_gvrp_init(void) | ||
{ | ||
return garp_register_application(&vlan_gvrp_app); | ||
} | ||
|
||
void vlan_gvrp_uninit(void) | ||
{ | ||
garp_unregister_application(&vlan_gvrp_app); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters