Blame view
net/8021q/vlan_gvrp.c
1.6 KB
d2912cb15 treewide: Replace... |
1 |
// SPDX-License-Identifier: GPL-2.0-only |
70c03b49b vlan: Add GVRP su... |
2 3 4 5 |
/* * IEEE 802.1Q GARP VLAN Registration Protocol (GVRP) * * Copyright (c) 2008 Patrick McHardy <kaber@trash.net> |
70c03b49b vlan: Add GVRP su... |
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
*/ #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) { |
7da82c06d vlan: rename vlan... |
29 |
const struct vlan_dev_priv *vlan = vlan_dev_priv(dev); |
9bb8582ef vlan: TCI related... |
30 |
__be16 vlan_id = htons(vlan->vlan_id); |
70c03b49b vlan: Add GVRP su... |
31 |
|
1fd9b1fc3 net: vlan: prepar... |
32 33 |
if (vlan->vlan_proto != htons(ETH_P_8021Q)) return 0; |
70c03b49b vlan: Add GVRP su... |
34 |
return garp_request_join(vlan->real_dev, &vlan_gvrp_app, |
9bb8582ef vlan: TCI related... |
35 |
&vlan_id, sizeof(vlan_id), GVRP_ATTR_VID); |
70c03b49b vlan: Add GVRP su... |
36 37 38 39 |
} void vlan_gvrp_request_leave(const struct net_device *dev) { |
7da82c06d vlan: rename vlan... |
40 |
const struct vlan_dev_priv *vlan = vlan_dev_priv(dev); |
9bb8582ef vlan: TCI related... |
41 |
__be16 vlan_id = htons(vlan->vlan_id); |
70c03b49b vlan: Add GVRP su... |
42 |
|
1fd9b1fc3 net: vlan: prepar... |
43 44 |
if (vlan->vlan_proto != htons(ETH_P_8021Q)) return; |
70c03b49b vlan: Add GVRP su... |
45 |
garp_request_leave(vlan->real_dev, &vlan_gvrp_app, |
9bb8582ef vlan: TCI related... |
46 |
&vlan_id, sizeof(vlan_id), GVRP_ATTR_VID); |
70c03b49b vlan: Add GVRP su... |
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
} 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); } |