br_netlink.c (17fa87fe5a5141d3c082c5c91e950aca9e0ec701) br_netlink.c (f7cdee8a79a1cb03fa9ca71b825e72f880b344e1)
1/*
2 * Bridge netlink control interface
3 *
4 * Authors:
5 * Stephen Hemminger <shemminger@osdl.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License

--- 6 unchanged lines hidden (view full) ---

15#include <linux/etherdevice.h>
16#include <net/rtnetlink.h>
17#include <net/net_namespace.h>
18#include <net/sock.h>
19#include <uapi/linux/if_bridge.h>
20
21#include "br_private.h"
22#include "br_private_stp.h"
1/*
2 * Bridge netlink control interface
3 *
4 * Authors:
5 * Stephen Hemminger <shemminger@osdl.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License

--- 6 unchanged lines hidden (view full) ---

15#include <linux/etherdevice.h>
16#include <net/rtnetlink.h>
17#include <net/net_namespace.h>
18#include <net/sock.h>
19#include <uapi/linux/if_bridge.h>
20
21#include "br_private.h"
22#include "br_private_stp.h"
23#include "br_private_tunnel.h"
23
24static int __get_num_vlan_infos(struct net_bridge_vlan_group *vg,
25 u32 filter_mask)
26{
27 struct net_bridge_vlan *v;
28 u16 vid_range_start = 0, vid_range_end = 0, vid_range_flags = 0;
29 u16 flags, pvid;
30 int num_vlans = 0;

--- 59 unchanged lines hidden (view full) ---

90
91 return num_vlans;
92}
93
94static size_t br_get_link_af_size_filtered(const struct net_device *dev,
95 u32 filter_mask)
96{
97 struct net_bridge_vlan_group *vg = NULL;
24
25static int __get_num_vlan_infos(struct net_bridge_vlan_group *vg,
26 u32 filter_mask)
27{
28 struct net_bridge_vlan *v;
29 u16 vid_range_start = 0, vid_range_end = 0, vid_range_flags = 0;
30 u16 flags, pvid;
31 int num_vlans = 0;

--- 59 unchanged lines hidden (view full) ---

91
92 return num_vlans;
93}
94
95static size_t br_get_link_af_size_filtered(const struct net_device *dev,
96 u32 filter_mask)
97{
98 struct net_bridge_vlan_group *vg = NULL;
98 struct net_bridge_port *p;
99 struct net_bridge_port *p = NULL;
99 struct net_bridge *br;
100 int num_vlan_infos;
100 struct net_bridge *br;
101 int num_vlan_infos;
102 size_t vinfo_sz = 0;
101
102 rcu_read_lock();
103 if (br_port_exists(dev)) {
104 p = br_port_get_rcu(dev);
105 vg = nbp_vlan_group_rcu(p);
106 } else if (dev->priv_flags & IFF_EBRIDGE) {
107 br = netdev_priv(dev);
108 vg = br_vlan_group_rcu(br);
109 }
110 num_vlan_infos = br_get_num_vlan_infos(vg, filter_mask);
111 rcu_read_unlock();
112
103
104 rcu_read_lock();
105 if (br_port_exists(dev)) {
106 p = br_port_get_rcu(dev);
107 vg = nbp_vlan_group_rcu(p);
108 } else if (dev->priv_flags & IFF_EBRIDGE) {
109 br = netdev_priv(dev);
110 vg = br_vlan_group_rcu(br);
111 }
112 num_vlan_infos = br_get_num_vlan_infos(vg, filter_mask);
113 rcu_read_unlock();
114
115 if (p && (p->flags & BR_VLAN_TUNNEL))
116 vinfo_sz += br_get_vlan_tunnel_info_size(vg);
117
113 /* Each VLAN is returned in bridge_vlan_info along with flags */
118 /* Each VLAN is returned in bridge_vlan_info along with flags */
114 return num_vlan_infos * nla_total_size(sizeof(struct bridge_vlan_info));
119 vinfo_sz += num_vlan_infos * nla_total_size(sizeof(struct bridge_vlan_info));
120
121 return vinfo_sz;
115}
116
117static inline size_t br_port_info_size(void)
118{
119 return nla_total_size(1) /* IFLA_BRPORT_STATE */
120 + nla_total_size(2) /* IFLA_BRPORT_PRIORITY */
121 + nla_total_size(4) /* IFLA_BRPORT_COST */
122 + nla_total_size(1) /* IFLA_BRPORT_MODE */
123 + nla_total_size(1) /* IFLA_BRPORT_GUARD */
124 + nla_total_size(1) /* IFLA_BRPORT_PROTECT */
125 + nla_total_size(1) /* IFLA_BRPORT_FAST_LEAVE */
122}
123
124static inline size_t br_port_info_size(void)
125{
126 return nla_total_size(1) /* IFLA_BRPORT_STATE */
127 + nla_total_size(2) /* IFLA_BRPORT_PRIORITY */
128 + nla_total_size(4) /* IFLA_BRPORT_COST */
129 + nla_total_size(1) /* IFLA_BRPORT_MODE */
130 + nla_total_size(1) /* IFLA_BRPORT_GUARD */
131 + nla_total_size(1) /* IFLA_BRPORT_PROTECT */
132 + nla_total_size(1) /* IFLA_BRPORT_FAST_LEAVE */
133 + nla_total_size(1) /* IFLA_BRPORT_MCAST_TO_UCAST */
126 + nla_total_size(1) /* IFLA_BRPORT_LEARNING */
127 + nla_total_size(1) /* IFLA_BRPORT_UNICAST_FLOOD */
128 + nla_total_size(1) /* IFLA_BRPORT_PROXYARP */
129 + nla_total_size(1) /* IFLA_BRPORT_PROXYARP_WIFI */
134 + nla_total_size(1) /* IFLA_BRPORT_LEARNING */
135 + nla_total_size(1) /* IFLA_BRPORT_UNICAST_FLOOD */
136 + nla_total_size(1) /* IFLA_BRPORT_PROXYARP */
137 + nla_total_size(1) /* IFLA_BRPORT_PROXYARP_WIFI */
138 + nla_total_size(1) /* IFLA_BRPORT_VLAN_TUNNEL */
130 + nla_total_size(sizeof(struct ifla_bridge_id)) /* IFLA_BRPORT_ROOT_ID */
131 + nla_total_size(sizeof(struct ifla_bridge_id)) /* IFLA_BRPORT_BRIDGE_ID */
132 + nla_total_size(sizeof(u16)) /* IFLA_BRPORT_DESIGNATED_PORT */
133 + nla_total_size(sizeof(u16)) /* IFLA_BRPORT_DESIGNATED_COST */
134 + nla_total_size(sizeof(u16)) /* IFLA_BRPORT_ID */
135 + nla_total_size(sizeof(u16)) /* IFLA_BRPORT_NO */
136 + nla_total_size(sizeof(u8)) /* IFLA_BRPORT_TOPOLOGY_CHANGE_ACK */
137 + nla_total_size(sizeof(u8)) /* IFLA_BRPORT_CONFIG_PENDING */

--- 30 unchanged lines hidden (view full) ---

168 nla_put_u16(skb, IFLA_BRPORT_PRIORITY, p->priority) ||
169 nla_put_u32(skb, IFLA_BRPORT_COST, p->path_cost) ||
170 nla_put_u8(skb, IFLA_BRPORT_MODE, mode) ||
171 nla_put_u8(skb, IFLA_BRPORT_GUARD, !!(p->flags & BR_BPDU_GUARD)) ||
172 nla_put_u8(skb, IFLA_BRPORT_PROTECT,
173 !!(p->flags & BR_ROOT_BLOCK)) ||
174 nla_put_u8(skb, IFLA_BRPORT_FAST_LEAVE,
175 !!(p->flags & BR_MULTICAST_FAST_LEAVE)) ||
139 + nla_total_size(sizeof(struct ifla_bridge_id)) /* IFLA_BRPORT_ROOT_ID */
140 + nla_total_size(sizeof(struct ifla_bridge_id)) /* IFLA_BRPORT_BRIDGE_ID */
141 + nla_total_size(sizeof(u16)) /* IFLA_BRPORT_DESIGNATED_PORT */
142 + nla_total_size(sizeof(u16)) /* IFLA_BRPORT_DESIGNATED_COST */
143 + nla_total_size(sizeof(u16)) /* IFLA_BRPORT_ID */
144 + nla_total_size(sizeof(u16)) /* IFLA_BRPORT_NO */
145 + nla_total_size(sizeof(u8)) /* IFLA_BRPORT_TOPOLOGY_CHANGE_ACK */
146 + nla_total_size(sizeof(u8)) /* IFLA_BRPORT_CONFIG_PENDING */

--- 30 unchanged lines hidden (view full) ---

177 nla_put_u16(skb, IFLA_BRPORT_PRIORITY, p->priority) ||
178 nla_put_u32(skb, IFLA_BRPORT_COST, p->path_cost) ||
179 nla_put_u8(skb, IFLA_BRPORT_MODE, mode) ||
180 nla_put_u8(skb, IFLA_BRPORT_GUARD, !!(p->flags & BR_BPDU_GUARD)) ||
181 nla_put_u8(skb, IFLA_BRPORT_PROTECT,
182 !!(p->flags & BR_ROOT_BLOCK)) ||
183 nla_put_u8(skb, IFLA_BRPORT_FAST_LEAVE,
184 !!(p->flags & BR_MULTICAST_FAST_LEAVE)) ||
185 nla_put_u8(skb, IFLA_BRPORT_MCAST_TO_UCAST,
186 !!(p->flags & BR_MULTICAST_TO_UNICAST)) ||
176 nla_put_u8(skb, IFLA_BRPORT_LEARNING, !!(p->flags & BR_LEARNING)) ||
177 nla_put_u8(skb, IFLA_BRPORT_UNICAST_FLOOD,
178 !!(p->flags & BR_FLOOD)) ||
179 nla_put_u8(skb, IFLA_BRPORT_MCAST_FLOOD,
180 !!(p->flags & BR_MCAST_FLOOD)) ||
181 nla_put_u8(skb, IFLA_BRPORT_PROXYARP, !!(p->flags & BR_PROXYARP)) ||
182 nla_put_u8(skb, IFLA_BRPORT_PROXYARP_WIFI,
183 !!(p->flags & BR_PROXYARP_WIFI)) ||
184 nla_put(skb, IFLA_BRPORT_ROOT_ID, sizeof(struct ifla_bridge_id),
185 &p->designated_root) ||
186 nla_put(skb, IFLA_BRPORT_BRIDGE_ID, sizeof(struct ifla_bridge_id),
187 &p->designated_bridge) ||
188 nla_put_u16(skb, IFLA_BRPORT_DESIGNATED_PORT, p->designated_port) ||
189 nla_put_u16(skb, IFLA_BRPORT_DESIGNATED_COST, p->designated_cost) ||
190 nla_put_u16(skb, IFLA_BRPORT_ID, p->port_id) ||
191 nla_put_u16(skb, IFLA_BRPORT_NO, p->port_no) ||
192 nla_put_u8(skb, IFLA_BRPORT_TOPOLOGY_CHANGE_ACK,
193 p->topology_change_ack) ||
187 nla_put_u8(skb, IFLA_BRPORT_LEARNING, !!(p->flags & BR_LEARNING)) ||
188 nla_put_u8(skb, IFLA_BRPORT_UNICAST_FLOOD,
189 !!(p->flags & BR_FLOOD)) ||
190 nla_put_u8(skb, IFLA_BRPORT_MCAST_FLOOD,
191 !!(p->flags & BR_MCAST_FLOOD)) ||
192 nla_put_u8(skb, IFLA_BRPORT_PROXYARP, !!(p->flags & BR_PROXYARP)) ||
193 nla_put_u8(skb, IFLA_BRPORT_PROXYARP_WIFI,
194 !!(p->flags & BR_PROXYARP_WIFI)) ||
195 nla_put(skb, IFLA_BRPORT_ROOT_ID, sizeof(struct ifla_bridge_id),
196 &p->designated_root) ||
197 nla_put(skb, IFLA_BRPORT_BRIDGE_ID, sizeof(struct ifla_bridge_id),
198 &p->designated_bridge) ||
199 nla_put_u16(skb, IFLA_BRPORT_DESIGNATED_PORT, p->designated_port) ||
200 nla_put_u16(skb, IFLA_BRPORT_DESIGNATED_COST, p->designated_cost) ||
201 nla_put_u16(skb, IFLA_BRPORT_ID, p->port_id) ||
202 nla_put_u16(skb, IFLA_BRPORT_NO, p->port_no) ||
203 nla_put_u8(skb, IFLA_BRPORT_TOPOLOGY_CHANGE_ACK,
204 p->topology_change_ack) ||
194 nla_put_u8(skb, IFLA_BRPORT_CONFIG_PENDING, p->config_pending))
205 nla_put_u8(skb, IFLA_BRPORT_CONFIG_PENDING, p->config_pending) ||
206 nla_put_u8(skb, IFLA_BRPORT_VLAN_TUNNEL, !!(p->flags &
207 BR_VLAN_TUNNEL)))
195 return -EMSGSIZE;
196
197 timerval = br_timer_value(&p->message_age_timer);
198 if (nla_put_u64_64bit(skb, IFLA_BRPORT_MESSAGE_AGE_TIMER, timerval,
199 IFLA_BRPORT_PAD))
200 return -EMSGSIZE;
201 timerval = br_timer_value(&p->forward_delay_timer);
202 if (nla_put_u64_64bit(skb, IFLA_BRPORT_FORWARD_DELAY_TIMER, timerval,

--- 206 unchanged lines hidden (view full) ---

409 if (!af) {
410 rcu_read_unlock();
411 goto nla_put_failure;
412 }
413 if (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)
414 err = br_fill_ifvlaninfo_compressed(skb, vg);
415 else
416 err = br_fill_ifvlaninfo(skb, vg);
208 return -EMSGSIZE;
209
210 timerval = br_timer_value(&p->message_age_timer);
211 if (nla_put_u64_64bit(skb, IFLA_BRPORT_MESSAGE_AGE_TIMER, timerval,
212 IFLA_BRPORT_PAD))
213 return -EMSGSIZE;
214 timerval = br_timer_value(&p->forward_delay_timer);
215 if (nla_put_u64_64bit(skb, IFLA_BRPORT_FORWARD_DELAY_TIMER, timerval,

--- 206 unchanged lines hidden (view full) ---

422 if (!af) {
423 rcu_read_unlock();
424 goto nla_put_failure;
425 }
426 if (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)
427 err = br_fill_ifvlaninfo_compressed(skb, vg);
428 else
429 err = br_fill_ifvlaninfo(skb, vg);
430
431 if (port && (port->flags & BR_VLAN_TUNNEL))
432 err = br_fill_vlan_tunnel_info(skb, vg);
417 rcu_read_unlock();
418 if (err)
419 goto nla_put_failure;
420 nla_nest_end(skb, af);
421 }
422
423done:
424 nlmsg_end(skb, nlh);

--- 84 unchanged lines hidden (view full) ---

509 br_vlan_delete(br, vinfo->vid);
510 }
511 break;
512 }
513
514 return err;
515}
516
433 rcu_read_unlock();
434 if (err)
435 goto nla_put_failure;
436 nla_nest_end(skb, af);
437 }
438
439done:
440 nlmsg_end(skb, nlh);

--- 84 unchanged lines hidden (view full) ---

525 br_vlan_delete(br, vinfo->vid);
526 }
527 break;
528 }
529
530 return err;
531}
532
533static int br_process_vlan_info(struct net_bridge *br,
534 struct net_bridge_port *p, int cmd,
535 struct bridge_vlan_info *vinfo_curr,
536 struct bridge_vlan_info **vinfo_last)
537{
538 if (!vinfo_curr->vid || vinfo_curr->vid >= VLAN_VID_MASK)
539 return -EINVAL;
540
541 if (vinfo_curr->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) {
542 /* check if we are already processing a range */
543 if (*vinfo_last)
544 return -EINVAL;
545 *vinfo_last = vinfo_curr;
546 /* don't allow range of pvids */
547 if ((*vinfo_last)->flags & BRIDGE_VLAN_INFO_PVID)
548 return -EINVAL;
549 return 0;
550 }
551
552 if (*vinfo_last) {
553 struct bridge_vlan_info tmp_vinfo;
554 int v, err;
555
556 if (!(vinfo_curr->flags & BRIDGE_VLAN_INFO_RANGE_END))
557 return -EINVAL;
558
559 if (vinfo_curr->vid <= (*vinfo_last)->vid)
560 return -EINVAL;
561
562 memcpy(&tmp_vinfo, *vinfo_last,
563 sizeof(struct bridge_vlan_info));
564 for (v = (*vinfo_last)->vid; v <= vinfo_curr->vid; v++) {
565 tmp_vinfo.vid = v;
566 err = br_vlan_info(br, p, cmd, &tmp_vinfo);
567 if (err)
568 break;
569 }
570 *vinfo_last = NULL;
571
572 return 0;
573 }
574
575 return br_vlan_info(br, p, cmd, vinfo_curr);
576}
577
517static int br_afspec(struct net_bridge *br,
518 struct net_bridge_port *p,
519 struct nlattr *af_spec,
520 int cmd)
521{
578static int br_afspec(struct net_bridge *br,
579 struct net_bridge_port *p,
580 struct nlattr *af_spec,
581 int cmd)
582{
522 struct bridge_vlan_info *vinfo_start = NULL;
523 struct bridge_vlan_info *vinfo = NULL;
583 struct bridge_vlan_info *vinfo_curr = NULL;
584 struct bridge_vlan_info *vinfo_last = NULL;
524 struct nlattr *attr;
585 struct nlattr *attr;
525 int err = 0;
526 int rem;
586 struct vtunnel_info tinfo_last = {};
587 struct vtunnel_info tinfo_curr = {};
588 int err = 0, rem;
527
528 nla_for_each_nested(attr, af_spec, rem) {
589
590 nla_for_each_nested(attr, af_spec, rem) {
529 if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO)
530 continue;
531 if (nla_len(attr) != sizeof(struct bridge_vlan_info))
532 return -EINVAL;
533 vinfo = nla_data(attr);
534 if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)
535 return -EINVAL;
536 if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) {
537 if (vinfo_start)
591 err = 0;
592 switch (nla_type(attr)) {
593 case IFLA_BRIDGE_VLAN_TUNNEL_INFO:
594 if (!(p->flags & BR_VLAN_TUNNEL))
538 return -EINVAL;
595 return -EINVAL;
539 vinfo_start = vinfo;
540 /* don't allow range of pvids */
541 if (vinfo_start->flags & BRIDGE_VLAN_INFO_PVID)
596 err = br_parse_vlan_tunnel_info(attr, &tinfo_curr);
597 if (err)
598 return err;
599 err = br_process_vlan_tunnel_info(br, p, cmd,
600 &tinfo_curr,
601 &tinfo_last);
602 if (err)
603 return err;
604 break;
605 case IFLA_BRIDGE_VLAN_INFO:
606 if (nla_len(attr) != sizeof(struct bridge_vlan_info))
542 return -EINVAL;
607 return -EINVAL;
543 continue;
608 vinfo_curr = nla_data(attr);
609 err = br_process_vlan_info(br, p, cmd, vinfo_curr,
610 &vinfo_last);
611 if (err)
612 return err;
613 break;
544 }
545
614 }
615
546 if (vinfo_start) {
547 struct bridge_vlan_info tmp_vinfo;
548 int v;
549
550 if (!(vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END))
551 return -EINVAL;
552
553 if (vinfo->vid <= vinfo_start->vid)
554 return -EINVAL;
555
556 memcpy(&tmp_vinfo, vinfo_start,
557 sizeof(struct bridge_vlan_info));
558
559 for (v = vinfo_start->vid; v <= vinfo->vid; v++) {
560 tmp_vinfo.vid = v;
561 err = br_vlan_info(br, p, cmd, &tmp_vinfo);
562 if (err)
563 break;
564 }
565 vinfo_start = NULL;
566 } else {
567 err = br_vlan_info(br, p, cmd, vinfo);
568 }
569 if (err)
616 if (err)
570 break;
617 return err;
571 }
572
573 return err;
574}
575
576static const struct nla_policy br_port_policy[IFLA_BRPORT_MAX + 1] = {
577 [IFLA_BRPORT_STATE] = { .type = NLA_U8 },
578 [IFLA_BRPORT_COST] = { .type = NLA_U32 },
579 [IFLA_BRPORT_PRIORITY] = { .type = NLA_U16 },
580 [IFLA_BRPORT_MODE] = { .type = NLA_U8 },
581 [IFLA_BRPORT_GUARD] = { .type = NLA_U8 },
582 [IFLA_BRPORT_PROTECT] = { .type = NLA_U8 },
583 [IFLA_BRPORT_FAST_LEAVE]= { .type = NLA_U8 },
584 [IFLA_BRPORT_LEARNING] = { .type = NLA_U8 },
585 [IFLA_BRPORT_UNICAST_FLOOD] = { .type = NLA_U8 },
586 [IFLA_BRPORT_PROXYARP] = { .type = NLA_U8 },
587 [IFLA_BRPORT_PROXYARP_WIFI] = { .type = NLA_U8 },
588 [IFLA_BRPORT_MULTICAST_ROUTER] = { .type = NLA_U8 },
618 }
619
620 return err;
621}
622
623static const struct nla_policy br_port_policy[IFLA_BRPORT_MAX + 1] = {
624 [IFLA_BRPORT_STATE] = { .type = NLA_U8 },
625 [IFLA_BRPORT_COST] = { .type = NLA_U32 },
626 [IFLA_BRPORT_PRIORITY] = { .type = NLA_U16 },
627 [IFLA_BRPORT_MODE] = { .type = NLA_U8 },
628 [IFLA_BRPORT_GUARD] = { .type = NLA_U8 },
629 [IFLA_BRPORT_PROTECT] = { .type = NLA_U8 },
630 [IFLA_BRPORT_FAST_LEAVE]= { .type = NLA_U8 },
631 [IFLA_BRPORT_LEARNING] = { .type = NLA_U8 },
632 [IFLA_BRPORT_UNICAST_FLOOD] = { .type = NLA_U8 },
633 [IFLA_BRPORT_PROXYARP] = { .type = NLA_U8 },
634 [IFLA_BRPORT_PROXYARP_WIFI] = { .type = NLA_U8 },
635 [IFLA_BRPORT_MULTICAST_ROUTER] = { .type = NLA_U8 },
636 [IFLA_BRPORT_MCAST_TO_UCAST] = { .type = NLA_U8 },
589};
590
591/* Change the state of the port and notify spanning tree */
592static int br_set_port_state(struct net_bridge_port *p, u8 state)
593{
594 if (state > BR_STATE_BLOCKING)
595 return -EINVAL;
596

--- 24 unchanged lines hidden (view full) ---

621 else
622 p->flags &= ~mask;
623 }
624}
625
626/* Process bridge protocol info on port */
627static int br_setport(struct net_bridge_port *p, struct nlattr *tb[])
628{
637};
638
639/* Change the state of the port and notify spanning tree */
640static int br_set_port_state(struct net_bridge_port *p, u8 state)
641{
642 if (state > BR_STATE_BLOCKING)
643 return -EINVAL;
644

--- 24 unchanged lines hidden (view full) ---

669 else
670 p->flags &= ~mask;
671 }
672}
673
674/* Process bridge protocol info on port */
675static int br_setport(struct net_bridge_port *p, struct nlattr *tb[])
676{
629 int err;
630 unsigned long old_flags = p->flags;
677 unsigned long old_flags = p->flags;
678 bool br_vlan_tunnel_old = false;
679 int err;
631
632 br_set_port_flag(p, tb, IFLA_BRPORT_MODE, BR_HAIRPIN_MODE);
633 br_set_port_flag(p, tb, IFLA_BRPORT_GUARD, BR_BPDU_GUARD);
634 br_set_port_flag(p, tb, IFLA_BRPORT_FAST_LEAVE, BR_MULTICAST_FAST_LEAVE);
635 br_set_port_flag(p, tb, IFLA_BRPORT_PROTECT, BR_ROOT_BLOCK);
636 br_set_port_flag(p, tb, IFLA_BRPORT_LEARNING, BR_LEARNING);
637 br_set_port_flag(p, tb, IFLA_BRPORT_UNICAST_FLOOD, BR_FLOOD);
638 br_set_port_flag(p, tb, IFLA_BRPORT_MCAST_FLOOD, BR_MCAST_FLOOD);
680
681 br_set_port_flag(p, tb, IFLA_BRPORT_MODE, BR_HAIRPIN_MODE);
682 br_set_port_flag(p, tb, IFLA_BRPORT_GUARD, BR_BPDU_GUARD);
683 br_set_port_flag(p, tb, IFLA_BRPORT_FAST_LEAVE, BR_MULTICAST_FAST_LEAVE);
684 br_set_port_flag(p, tb, IFLA_BRPORT_PROTECT, BR_ROOT_BLOCK);
685 br_set_port_flag(p, tb, IFLA_BRPORT_LEARNING, BR_LEARNING);
686 br_set_port_flag(p, tb, IFLA_BRPORT_UNICAST_FLOOD, BR_FLOOD);
687 br_set_port_flag(p, tb, IFLA_BRPORT_MCAST_FLOOD, BR_MCAST_FLOOD);
688 br_set_port_flag(p, tb, IFLA_BRPORT_MCAST_TO_UCAST, BR_MULTICAST_TO_UNICAST);
639 br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP, BR_PROXYARP);
640 br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP_WIFI, BR_PROXYARP_WIFI);
641
689 br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP, BR_PROXYARP);
690 br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP_WIFI, BR_PROXYARP_WIFI);
691
692 br_vlan_tunnel_old = (p->flags & BR_VLAN_TUNNEL) ? true : false;
693 br_set_port_flag(p, tb, IFLA_BRPORT_VLAN_TUNNEL, BR_VLAN_TUNNEL);
694 if (br_vlan_tunnel_old && !(p->flags & BR_VLAN_TUNNEL))
695 nbp_vlan_tunnel_info_flush(p);
696
642 if (tb[IFLA_BRPORT_COST]) {
643 err = br_stp_set_path_cost(p, nla_get_u32(tb[IFLA_BRPORT_COST]));
644 if (err)
645 return err;
646 }
647
648 if (tb[IFLA_BRPORT_PRIORITY]) {
649 err = br_stp_set_port_priority(p, nla_get_u16(tb[IFLA_BRPORT_PRIORITY]));

--- 540 unchanged lines hidden (view full) ---

1190 return -EMSGSIZE;
1191 clockval = br_timer_value(&br->tcn_timer);
1192 if (nla_put_u64_64bit(skb, IFLA_BR_TCN_TIMER, clockval, IFLA_BR_PAD))
1193 return -EMSGSIZE;
1194 clockval = br_timer_value(&br->topology_change_timer);
1195 if (nla_put_u64_64bit(skb, IFLA_BR_TOPOLOGY_CHANGE_TIMER, clockval,
1196 IFLA_BR_PAD))
1197 return -EMSGSIZE;
697 if (tb[IFLA_BRPORT_COST]) {
698 err = br_stp_set_path_cost(p, nla_get_u32(tb[IFLA_BRPORT_COST]));
699 if (err)
700 return err;
701 }
702
703 if (tb[IFLA_BRPORT_PRIORITY]) {
704 err = br_stp_set_port_priority(p, nla_get_u16(tb[IFLA_BRPORT_PRIORITY]));

--- 540 unchanged lines hidden (view full) ---

1245 return -EMSGSIZE;
1246 clockval = br_timer_value(&br->tcn_timer);
1247 if (nla_put_u64_64bit(skb, IFLA_BR_TCN_TIMER, clockval, IFLA_BR_PAD))
1248 return -EMSGSIZE;
1249 clockval = br_timer_value(&br->topology_change_timer);
1250 if (nla_put_u64_64bit(skb, IFLA_BR_TOPOLOGY_CHANGE_TIMER, clockval,
1251 IFLA_BR_PAD))
1252 return -EMSGSIZE;
1198 clockval = br_timer_value(&br->gc_timer);
1253 clockval = br_timer_value(&br->gc_work.timer);
1199 if (nla_put_u64_64bit(skb, IFLA_BR_GC_TIMER, clockval, IFLA_BR_PAD))
1200 return -EMSGSIZE;
1201
1202 if (nla_put_u32(skb, IFLA_BR_FORWARD_DELAY, forward_delay) ||
1203 nla_put_u32(skb, IFLA_BR_HELLO_TIME, hello_time) ||
1204 nla_put_u32(skb, IFLA_BR_MAX_AGE, age_time) ||
1205 nla_put_u32(skb, IFLA_BR_AGEING_TIME, ageing_time) ||
1206 nla_put_u32(skb, IFLA_BR_STP_STATE, stp_enabled) ||

--- 249 unchanged lines hidden ---
1254 if (nla_put_u64_64bit(skb, IFLA_BR_GC_TIMER, clockval, IFLA_BR_PAD))
1255 return -EMSGSIZE;
1256
1257 if (nla_put_u32(skb, IFLA_BR_FORWARD_DELAY, forward_delay) ||
1258 nla_put_u32(skb, IFLA_BR_HELLO_TIME, hello_time) ||
1259 nla_put_u32(skb, IFLA_BR_MAX_AGE, age_time) ||
1260 nla_put_u32(skb, IFLA_BR_AGEING_TIME, ageing_time) ||
1261 nla_put_u32(skb, IFLA_BR_STP_STATE, stp_enabled) ||

--- 249 unchanged lines hidden ---