1 /*****************************************************************************
2 Copyright (c) 2006 EMC Corporation.
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2 of the License, or (at your option)
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 You should have received a copy of the GNU General Public License along with
15 this program; if not, write to the Free Software Foundation, Inc., 59
16 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 The full GNU General Public License is included in this distribution in the
21 Authors: Srinivas Aji <Aji_Srinivas@emc.com>
23 ******************************************************************************/
25 #include "bridge_ctl.h"
26 #include "netif_utils.h"
30 #include <linux/if_bridge.h>
31 #include <arpa/inet.h>
32 #include <sys/types.h>
45 /*------------------------------------------------------------*/
55 struct ifdata
*bridge_next
;
56 struct ifdata
*port_list
;
59 struct stp_instance
*stp
;
60 UID_BRIDGE_ID_T bridge_id
;
62 UID_STP_MODE_T stp_enabled
;
73 struct ifdata
*master
;
74 struct ifdata
*port_next
;
79 int admin_port_path_cost
;
80 ADMIN_P2P_T admin_point2point
;
81 unsigned char admin_edge
;
82 unsigned char admin_non_stp
; /* 1- doesn't participate in STP, 1 - regular */
86 struct ifdata
*current_br
= NULL
;
88 void instance_begin(struct ifdata
*br
)
91 ERROR("BUG: Trying to set instance over existing instance.");
92 ERROR("%d", *(int *)0); /* ABORT */
95 STP_IN_instance_begin(br
->stp
);
98 void instance_end(void)
100 STP_IN_instance_end(current_br
->stp
);
104 struct ifdata
*find_port(int port_index
)
106 struct ifdata
*ifc
= current_br
->port_list
;
107 while (ifc
&& ifc
->port_index
!= port_index
)
108 ifc
= ifc
->port_next
;
112 /*************************************************************/
113 /* Bridge and port defaults */
115 UID_STP_CFG_T default_bridge_stp_cfg
= {
116 .field_mask
= BR_CFG_ALL
,
117 .bridge_priority
= DEF_BR_PRIO
,
118 .max_age
= DEF_BR_MAXAGE
,
119 .hello_time
= DEF_BR_HELLOT
,
120 .forward_delay
= DEF_BR_FWDELAY
,
121 .force_version
= DEF_FORCE_VERS
, /*NORMAL_RSTP */
124 void update_bridge_stp_config(struct ifdata
*br
, UID_STP_CFG_T
* cfg
)
126 if (cfg
->field_mask
& BR_CFG_PRIO
)
127 br
->bridge_priority
= cfg
->bridge_priority
;
128 if (cfg
->field_mask
& BR_CFG_AGE
)
129 br
->max_age
= cfg
->max_age
;
130 if (cfg
->field_mask
& BR_CFG_HELLO
)
131 br
->hello_time
= cfg
->hello_time
;
132 if (cfg
->field_mask
& BR_CFG_DELAY
)
133 br
->forward_delay
= cfg
->forward_delay
;
134 if (cfg
->field_mask
& BR_CFG_FORCE_VER
)
135 br
->force_version
= cfg
->force_version
;
138 UID_STP_PORT_CFG_T default_port_stp_cfg
= {
139 .field_mask
= PT_CFG_ALL
,
140 .port_priority
= DEF_PORT_PRIO
,
141 .admin_non_stp
= DEF_ADMIN_NON_STP
,
142 .admin_edge
= False
, // DEF_ADMIN_EDGE,
143 .admin_port_path_cost
= ADMIN_PORT_PATH_COST_AUTO
,
144 .admin_point2point
= DEF_P2P
,
147 void update_port_stp_config(struct ifdata
*ifc
, UID_STP_PORT_CFG_T
* cfg
)
149 if (cfg
->field_mask
& PT_CFG_PRIO
)
150 ifc
->port_priority
= cfg
->port_priority
;
151 if (cfg
->field_mask
& PT_CFG_NON_STP
)
152 ifc
->admin_non_stp
= cfg
->admin_non_stp
;
153 if (cfg
->field_mask
& PT_CFG_EDGE
)
154 ifc
->admin_edge
= cfg
->admin_edge
;
155 if (cfg
->field_mask
& PT_CFG_COST
)
156 ifc
->admin_port_path_cost
= cfg
->admin_port_path_cost
;
157 if (cfg
->field_mask
& PT_CFG_P2P
)
158 ifc
->admin_point2point
= cfg
->admin_point2point
;
161 /**************************************************************/
163 int add_port_stp(struct ifdata
*ifc
)
164 { /* Bridge is ifc->master */
166 TST(if_indextoname(ifc
->if_index
, name
) != 0, -1);
167 TST((ifc
->port_index
= get_bridge_portno(ifc
->name
)) >= 0, -1);
169 /* Add port to STP */
170 instance_begin(ifc
->master
);
171 int r
= STP_IN_port_create(0, ifc
->port_index
);
172 if (r
== 0) { /* Update bridge ID */
173 UID_STP_STATE_T state
;
174 STP_IN_stpm_get_state(0, &state
);
175 ifc
->master
->bridge_id
= state
.bridge_id
;
178 if (r
/* check for failure */ ) {
179 ERROR("Couldn't add port for ifindex %d to STP", ifc
->if_index
);
185 void remove_port_stp(struct ifdata
*ifc
)
187 /* Remove port from STP */
188 instance_begin(ifc
->master
);
189 int r
= STP_IN_port_delete(0, ifc
->port_index
);
191 ifc
->port_index
= -1;
193 ERROR("removing port %s failed for bridge %s: %s",
194 ifc
->name
, ifc
->master
->name
,
195 STP_IN_get_error_explanation(r
));
199 int init_rstplib_instance(struct ifdata
*br
)
201 br
->stp
= STP_IN_instance_create();
202 if (br
->stp
== NULL
) {
203 ERROR("Couldn't create STP instance for bridge %s", br
->name
);
210 int r
= STP_IN_stpm_create(0, br
->name
, &ports
);
213 ERROR("stpm create failed for bridge %s: %s",
214 br
->name
, STP_IN_get_error_explanation(r
));
221 void clear_rstplib_instance(struct ifdata
*br
)
224 int r
= STP_IN_delete_all();
227 ERROR("stpm delete failed for bridge %s: %s",
228 br
->name
, STP_IN_get_error_explanation(r
));
231 STP_IN_instance_delete(br
->stp
);
235 int init_bridge_stp(struct ifdata
*br
)
238 ERROR("STP already started");
243 TST(init_rstplib_instance(br
) == 0, -1);
245 struct ifdata
*p
= br
->port_list
;
247 if (add_port_stp(p
) != 0)
252 struct ifdata
*q
= br
->port_list
;
257 /* Clear bridge STP state */
258 clear_rstplib_instance(br
);
265 void clear_bridge_stp(struct ifdata
*br
)
270 struct ifdata
*p
= br
->port_list
;
275 /* Clear bridge STP state */
276 clear_rstplib_instance(br
);
279 struct ifdata
*if_head
= NULL
;
280 struct ifdata
*br_head
= NULL
;
282 struct ifdata
*find_if(int if_index
)
284 struct ifdata
*p
= if_head
;
285 while (p
&& p
->if_index
!= if_index
)
290 #define ADD_TO_LIST(_list, _next, _ifc) \
292 (_ifc)->_next = (_list); \
296 #define REMOVE_FROM_LIST(_list, _next, _ifc, _error_fmt, _args...) \
298 struct ifdata **_prev = &(_list); \
299 while (*_prev && *_prev != (_ifc)) \
300 _prev = &(*_prev)->_next; \
301 if (*_prev != (_ifc)) \
302 ERROR(_error_fmt, ##_args); \
304 *_prev = (_ifc)->_next; \
307 /* Caller ensures that there isn't any ifdata with this index */
308 /* If br is NULL, new interface is a bridge, else it is a port of br */
309 struct ifdata
*create_if(int if_index
, struct ifdata
*br
)
312 TST((p
= malloc(sizeof(*p
))) != NULL
, NULL
);
315 p
->if_index
= if_index
;
316 p
->is_bridge
= (br
== NULL
);
317 memset(p
->name
, 0, sizeof(p
->name
));
318 if_indextoname(if_index
, p
->name
);
320 INFO("Add bridge %s", p
->name
);
321 /* Init slave list */
328 update_bridge_stp_config(p
, &default_bridge_stp_cfg
);
329 ADD_TO_LIST(br_head
, bridge_next
, p
); /* Add to bridge list */
331 INFO("Add iface %s to bridge %s", p
->name
, br
->name
);
336 update_port_stp_config(p
, &default_port_stp_cfg
);
337 ADD_TO_LIST(br
->port_list
, port_next
, p
); /* Add to bridge port list */
342 /* Add to interface list */
343 ADD_TO_LIST(if_head
, next
, p
);
348 void delete_if(struct ifdata
*ifc
)
350 INFO("Delete iface %s", ifc
->name
);
351 if (ifc
->is_bridge
) { /* Bridge: */
353 clear_bridge_stp(ifc
);
355 while (ifc
->port_list
)
356 delete_if(ifc
->port_list
);
357 /* Remove from bridge list */
358 REMOVE_FROM_LIST(br_head
, bridge_next
, ifc
,
359 "Can't find interface ifindex %d bridge list",
362 if (ifc
->master
->stp_up
)
363 remove_port_stp(ifc
);
364 /* Remove from bridge port list */
365 REMOVE_FROM_LIST(ifc
->master
->port_list
, port_next
, ifc
,
366 "Can't find interface ifindex %d on br %d's port list",
367 ifc
->if_index
, ifc
->master
->if_index
);
369 /* Remove from bridge interface list */
370 REMOVE_FROM_LIST(if_head
, next
, ifc
,
371 "Can't find interface ifindex %d on iflist",
375 void set_br_up(struct ifdata
*br
, int up
)
380 up
? (void)init_bridge_stp(br
) : clear_bridge_stp(br
);
384 void set_if_up(struct ifdata
*ifc
, int up
)
386 INFO("Port %s : %s", ifc
->name
, (up
? "up" : "down"));
389 int notify_flags
= 0;
390 const int NOTIFY_UP
= 1, NOTIFY_SPEED
= 2, NOTIFY_DUPLEX
= 4;
391 if (!up
) { /* Down */
394 notify_flags
|= NOTIFY_UP
;
397 int r
= ethtool_get_speed_duplex(ifc
->name
, &speed
, &duplex
);
398 if (r
< 0) { /* Didn't succeed */
403 duplex
= 0; /* Assume half duplex */
405 if (speed
!= ifc
->speed
) {
407 notify_flags
|= NOTIFY_SPEED
;
409 if (duplex
!= ifc
->duplex
) {
410 ifc
->duplex
= duplex
;
411 notify_flags
|= NOTIFY_DUPLEX
;
415 notify_flags
|= NOTIFY_UP
;
418 if (notify_flags
&& ifc
->master
->stp_up
) {
419 instance_begin(ifc
->master
);
421 if (notify_flags
& NOTIFY_SPEED
)
422 STP_IN_changed_port_speed(ifc
->port_index
, speed
);
423 if (notify_flags
& NOTIFY_DUPLEX
)
424 STP_IN_changed_port_duplex(ifc
->port_index
);
425 if (notify_flags
& NOTIFY_UP
)
426 STP_IN_enable_port(ifc
->port_index
, ifc
->up
);
432 /*------------------------------------------------------------*/
434 int bridge_notify(int br_index
, int if_index
, int newlink
, int up
)
438 LOG("br_index %d, if_index %d, up %d", br_index
, if_index
, up
);
440 struct ifdata
*br
= NULL
;
442 br
= find_if(br_index
);
443 if (br
&& !br
->is_bridge
) {
445 ("Notification shows non bridge interface %d as bridge.",
450 br
= create_if(br_index
, NULL
);
452 ERROR("Couldn't create data for bridge interface %d",
456 /* Bridge must be up if we get such notifications */
461 struct ifdata
*ifc
= find_if(if_index
);
465 if (ifc
->is_bridge
) {
467 ("Notification shows bridge interface %d as slave of %d",
471 if (ifc
->master
!= br
) {
472 INFO("Device %d has come to bridge %d. "
473 "Missed notify for deletion from bridge %d",
474 if_index
, br_index
, ifc
->master
->if_index
);
480 ifc
= create_if(if_index
, br
);
483 ("Couldn't create data for interface %d (master %d)",
487 if (!newlink
&& !is_bridge_slave(br
->name
, ifc
->name
)) {
488 /* brctl delif generates a DELLINK, but so does ifconfig <slave> down.
489 So check and delete if it has been removed.
495 set_if_up(ifc
, up
); /* And speed and duplex */
496 } else { /* No br_index */
498 /* DELLINK not from bridge means interface unregistered. */
499 /* Cleanup removed bridge or removed bridge slave */
503 } else { /* This may be a new link */
505 char ifname
[IFNAMSIZ
];
506 if (if_indextoname(if_index
, ifname
)
507 && is_bridge(ifname
)) {
508 ifc
= create_if(if_index
, NULL
);
511 ("Couldn't create data for bridge interface %d",
517 if (ifc
&& !ifc
->is_bridge
&&
518 !is_bridge_slave(ifc
->master
->name
, ifc
->name
)) {
519 /* Interface might have left bridge and we might have missed deletion */
523 if (ifc
&& ifc
->up
!= up
) {
534 void bridge_bpdu_rcv(int if_index
, const unsigned char *data
, int len
)
536 LOG("ifindex %d, len %d", if_index
, len
);
537 struct ifdata
*ifc
= find_if(if_index
);
538 TST(ifc
&& !ifc
->is_bridge
,);
539 TST(ifc
->up
&& ifc
->master
->stp_up
,);
541 memset(&bpdu
.eth
, 0, sizeof(bpdu
.eth
));
542 if (len
> sizeof(bpdu
) - sizeof(bpdu
.eth
))
543 len
= sizeof(bpdu
) - sizeof(bpdu
.eth
);
544 memcpy(&bpdu
.hdr
, data
, len
);
545 /* Do some validation */
547 TST(bpdu
.hdr
.protocol
[0] == 0 && bpdu
.hdr
.protocol
[1] == 0,);
548 switch (bpdu
.hdr
.bpdu_type
) {
551 case BPDU_CONFIG_TYPE
:
553 /* 802.1w doesn't ask for this */
554 // TST(ntohs(*(uint16_t*)bpdu.body.message_age)
555 // < ntohs(*(uint16_t*)bpdu.body.max_age), );
556 TST(memcmp(bpdu
.body
.bridge_id
, &ifc
->master
->bridge_id
, 8) != 0
557 || (ntohs(*(uint16_t *) bpdu
.body
.port_id
) & 0xfff) !=
560 case BPDU_TOPO_CHANGE_TYPE
:
566 // dump_hex(data, len);
567 instance_begin(ifc
->master
);
569 STP_IN_rx_bpdu(0, ifc
->port_index
, &bpdu
, len
+ sizeof(bpdu
.eth
));
571 ERROR("STP_IN_rx_bpdu on port %s returned %s", ifc
->name
,
572 STP_IN_get_error_explanation(r
));
576 void bridge_one_second(void)
580 for (br
= br_head
; br
; br
= br
->bridge_next
) {
588 /* To get information about port changes when bridge is down */
589 /* But won't work so well since we will not sense deletions */
590 static int count
= 0;
593 bridge_get_configuration();
597 /* Implementing STP_OUT functions */
599 int flush_port(char *sys_name
)
601 FILE *f
= fopen(sys_name
, "w");
602 TSTM(f
, -1, "Couldn't open flush file %s for write.", sys_name
);
603 int r
= fwrite("1", 1, 1, f
);
610 STP_OUT_flush_lt(IN
int port_index
, IN
int vlan_id
,
611 IN LT_FLASH_TYPE_T type
, IN
char *reason
)
613 LOG("port index %d, flash type %d, reason %s", port_index
, type
,
615 TST(vlan_id
== 0, 0);
618 if (port_index
== 0) { /* i.e. passed port_index was 0 */
619 sprintf(fname
, "/sys/class/net/%s/bridge/flush",
622 } else if (type
== LT_FLASH_ONLY_THE_PORT
) {
623 struct ifdata
*port
= find_port(port_index
);
624 TST(port
!= NULL
, 0);
625 sprintf(fname
, "/sys/class/net/%s/brif/%s/flush",
626 current_br
->name
, port
->name
);
628 } else if (type
== LT_FLASH_ALL_PORTS_EXCLUDE_THIS
) {
630 for (port
= current_br
->port_list
; port
; port
= port
->port_next
) {
631 if (port
->port_index
!= port_index
) {
633 "/sys/class/net/%s/brif/%s/flush",
634 current_br
->name
, port
->name
);
644 void /* for bridge id calculation */ STP_OUT_get_port_mac(IN
int port_index
,
648 LOG("port index %d", port_index
);
649 struct ifdata
*port
= find_port(port_index
);
651 get_hwaddr(port
->name
, mac
);
654 unsigned long STP_OUT_get_port_oper_speed(IN
unsigned int port_index
)
656 LOG("port index %d", port_index
);
657 struct ifdata
*port
= find_port(port_index
);
658 TST(port
!= NULL
, 0);
659 LOG("Speed: %d", port
->speed
);
663 int /* 1- Up, 0- Down */ STP_OUT_get_port_link_status(IN
int port_index
)
665 LOG("port index %d", port_index
);
666 struct ifdata
*port
= find_port(port_index
);
667 TST(port
!= NULL
, 0);
668 LOG("Link status: %d", port
->up
);
672 int /* 1- Full, 0- Half */ STP_OUT_get_duplex(IN
int port_index
)
674 LOG("port index %d", port_index
);
675 struct ifdata
*port
= find_port(port_index
);
676 TST(port
!= NULL
, 0);
677 LOG("Duplex: %d", port
->duplex
);
682 STP_OUT_set_port_state(IN
int port_index
, IN
int vlan_id
,
683 IN RSTP_PORT_STATE state
)
685 LOG("port index %d, state %d", port_index
, state
);
686 struct ifdata
*port
= find_port(port_index
);
687 TST(port
!= NULL
, 0);
688 TST(vlan_id
== 0, 0);
692 case UID_PORT_DISCARDING
:
693 br_state
= BR_STATE_BLOCKING
;
695 case UID_PORT_LEARNING
:
696 br_state
= BR_STATE_LEARNING
;
698 case UID_PORT_FORWARDING
:
699 br_state
= BR_STATE_FORWARDING
;
702 fprintf(stderr
, "set_port_state: Unexpected state %d\n", state
);
706 bridge_set_state(port
->if_index
, br_state
);
710 int STP_OUT_set_hardware_mode(int vlan_id
, UID_STP_MODE_T mode
)
712 LOG("vlan id %d, mode %d", vlan_id
, mode
);
717 STP_OUT_tx_bpdu(IN
int port_index
, IN
int vlan_id
,
718 IN
unsigned char *bpdu
, IN
size_t bpdu_len
)
720 LOG("port index %d, len %zd", port_index
, bpdu_len
);
721 struct ifdata
*port
= find_port(port_index
);
722 TST(port
!= NULL
, 0);
723 TST(vlan_id
== 0, 0);
724 // dump_hex(bpdu + sizeof(MAC_HEADER_T) + sizeof(ETH_HEADER_T),
725 // bpdu_len - (sizeof(MAC_HEADER_T) + sizeof(ETH_HEADER_T)));
726 bridge_send_bpdu(port
->if_index
, bpdu
+ sizeof(MAC_HEADER_T
) + sizeof(ETH_HEADER_T
), bpdu_len
); // The length we get excludes headers!
730 const char *STP_OUT_get_port_name(IN
int port_index
)
732 LOG("port index %d", port_index
);
733 struct ifdata
*port
= find_port(port_index
);
734 TST(port
!= NULL
, 0);
738 int STP_OUT_get_init_stpm_cfg(IN
int vlan_id
, INOUT UID_STP_CFG_T
* cfg
)
741 TST(vlan_id
== 0, 0);
743 cfg
->bridge_priority
= current_br
->bridge_priority
;
744 cfg
->max_age
= current_br
->max_age
;
745 cfg
->hello_time
= current_br
->hello_time
;
746 cfg
->forward_delay
= current_br
->forward_delay
;
747 cfg
->force_version
= current_br
->force_version
;
753 STP_OUT_get_init_port_cfg(IN
int vlan_id
,
754 IN
int port_index
, INOUT UID_STP_PORT_CFG_T
* cfg
)
756 LOG("port index %d", port_index
);
757 struct ifdata
*port
= find_port(port_index
);
758 TST(port
!= NULL
, 0);
759 TST(vlan_id
== 0, 0);
761 cfg
->port_priority
= port
->port_priority
;
762 cfg
->admin_non_stp
= port
->admin_non_stp
;
763 cfg
->admin_edge
= port
->admin_edge
;
764 cfg
->admin_port_path_cost
= port
->admin_port_path_cost
;
765 cfg
->admin_point2point
= port
->admin_point2point
;
770 extern void stp_trace(const char *fmt
, ...)
774 vDprintf(LOG_LEVEL_RSTPLIB
, fmt
, ap
);
778 /* Commands and status */
779 #include "ctl_functions.h"
781 #define CTL_CHECK_BRIDGE \
782 struct ifdata *br = find_if(br_index); \
783 if (br == NULL || !br->is_bridge) return Err_Interface_not_a_bridge; \
784 if (!br->do_stp) return Err_Bridge_RSTP_not_enabled; \
785 if (!br->stp_up) return Err_Bridge_is_down; \
788 #define CTL_CHECK_BRIDGE_PORT \
790 struct ifdata *port = find_if(port_index); \
791 if (port == NULL || port->is_bridge || port->master != br) \
792 return Err_Port_does_not_belong_to_bridge; \
795 int CTL_enable_bridge_rstp(int br_index
, int enable
)
797 INFO("bridge %d, enable %d", br_index
, enable
);
801 struct ifdata
*br
= find_if(br_index
);
803 char ifname
[IFNAMSIZ
];
804 if (if_indextoname(br_index
, ifname
) && is_bridge(ifname
))
805 br
= create_if(br_index
, NULL
);
807 if (br
== NULL
|| !br
->is_bridge
)
808 return Err_Interface_not_a_bridge
;
809 if (br
->do_stp
!= enable
) {
812 r
= enable
? init_bridge_stp(br
)
813 : (clear_bridge_stp(br
), 0);
818 int CTL_get_bridge_state(int br_index
,
819 UID_STP_CFG_T
* cfg
, UID_STP_STATE_T
* state
)
821 LOG("bridge %d", br_index
);
825 r
= STP_IN_stpm_get_state(0, state
);
827 ERROR("Error getting bridge state for %d: %s", br_index
,
828 STP_IN_get_error_explanation(r
));
832 r
= STP_IN_stpm_get_cfg(0, cfg
);
834 ERROR("Error getting bridge config for %d: %s", br_index
,
835 STP_IN_get_error_explanation(r
));
843 int CTL_set_bridge_config(int br_index
, UID_STP_CFG_T
* cfg
)
845 INFO("bridge %d, flags %#lx", br_index
, cfg
->field_mask
);
849 r
= STP_IN_stpm_set_cfg(0, NULL
, cfg
);
851 ERROR("Error setting bridge config for %d: %s", br_index
,
852 STP_IN_get_error_explanation(r
));
857 /* Change init config in ifdata so it will be applied if we
858 disable and enable rstp */
859 update_bridge_stp_config(br
, cfg
);
863 int CTL_get_port_state(int br_index
, int port_index
,
864 UID_STP_PORT_CFG_T
* cfg
, UID_STP_PORT_STATE_T
* state
)
866 LOG("bridge %d port %d", br_index
, port_index
);
867 CTL_CHECK_BRIDGE_PORT
;
870 state
->port_no
= port
->port_index
;
871 r
= STP_IN_port_get_state(0, state
);
873 ERROR("Error getting port state for port %d, bridge %d: %s",
874 port
->port_index
, br_index
,
875 STP_IN_get_error_explanation(r
));
879 r
= STP_IN_port_get_cfg(0, port
->port_index
, cfg
);
881 ERROR("Error getting port config for port %d, bridge %d: %s",
882 port
->port_index
, br_index
,
883 STP_IN_get_error_explanation(r
));
892 int CTL_set_port_config(int br_index
, int port_index
, UID_STP_PORT_CFG_T
* cfg
)
894 INFO("bridge %d, port %d, flags %#lx", br_index
, port_index
,
896 CTL_CHECK_BRIDGE_PORT
;
899 r
= STP_IN_set_port_cfg(0, port
->port_index
, cfg
);
901 ERROR("Error setting port config for port %d, bridge %d: %s",
902 port
->port_index
, br_index
,
903 STP_IN_get_error_explanation(r
));
908 /* Change init config in ifdata so it will be applied if we
909 disable and enable rstp */
910 update_port_stp_config(port
, cfg
);
914 int CTL_set_debug_level(int level
)
916 INFO("level %d", level
);
921 #undef CTL_CHECK_BRIDGE_PORT
922 #undef CTL_CHECK_BRIDGE