diff options
Diffstat (limited to 'net/bridge/br_fdb.c')
-rw-r--r-- | net/bridge/br_fdb.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index ce5411995a63..96ab1d1748d0 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c | |||
@@ -92,8 +92,10 @@ static void fdb_delete(struct net_bridge *br, struct net_bridge_fdb_entry *f) | |||
92 | void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr) | 92 | void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr) |
93 | { | 93 | { |
94 | struct net_bridge *br = p->br; | 94 | struct net_bridge *br = p->br; |
95 | bool no_vlan = (nbp_get_vlan_info(p) == NULL) ? true : false; | 95 | struct net_port_vlans *pv = nbp_get_vlan_info(p); |
96 | bool no_vlan = !pv; | ||
96 | int i; | 97 | int i; |
98 | u16 vid; | ||
97 | 99 | ||
98 | spin_lock_bh(&br->hash_lock); | 100 | spin_lock_bh(&br->hash_lock); |
99 | 101 | ||
@@ -114,28 +116,37 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr) | |||
114 | f->addr.addr) && | 116 | f->addr.addr) && |
115 | nbp_vlan_find(op, vid)) { | 117 | nbp_vlan_find(op, vid)) { |
116 | f->dst = op; | 118 | f->dst = op; |
117 | goto insert; | 119 | goto skip_delete; |
118 | } | 120 | } |
119 | } | 121 | } |
120 | 122 | ||
121 | /* delete old one */ | 123 | /* delete old one */ |
122 | fdb_delete(br, f); | 124 | fdb_delete(br, f); |
123 | insert: | 125 | skip_delete: |
124 | /* insert new address, may fail if invalid | ||
125 | * address or dup. | ||
126 | */ | ||
127 | fdb_insert(br, p, newaddr, vid); | ||
128 | |||
129 | /* if this port has no vlan information | 126 | /* if this port has no vlan information |
130 | * configured, we can safely be done at | 127 | * configured, we can safely be done at |
131 | * this point. | 128 | * this point. |
132 | */ | 129 | */ |
133 | if (no_vlan) | 130 | if (no_vlan) |
134 | goto done; | 131 | goto insert; |
135 | } | 132 | } |
136 | } | 133 | } |
137 | } | 134 | } |
138 | 135 | ||
136 | insert: | ||
137 | /* insert new address, may fail if invalid address or dup. */ | ||
138 | fdb_insert(br, p, newaddr, 0); | ||
139 | |||
140 | if (no_vlan) | ||
141 | goto done; | ||
142 | |||
143 | /* Now add entries for every VLAN configured on the port. | ||
144 | * This function runs under RTNL so the bitmap will not change | ||
145 | * from under us. | ||
146 | */ | ||
147 | for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) | ||
148 | fdb_insert(br, p, newaddr, vid); | ||
149 | |||
139 | done: | 150 | done: |
140 | spin_unlock_bh(&br->hash_lock); | 151 | spin_unlock_bh(&br->hash_lock); |
141 | } | 152 | } |