From: Justin Pettit Date: Fri, 9 Jan 2009 22:12:24 +0000 (-0800) Subject: Delete extermally removed interfaces from bridge compatibility config. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7983a5a00f84d627184fbc1e4ab0e02eea790b3;p=openvswitch Delete extermally removed interfaces from bridge compatibility config. The bridge compatibility code was not notified when interfaces were removed from datapaths. This fixes that. --- diff --git a/vswitchd/brcompat.c b/vswitchd/brcompat.c index 75aa5bc2..6dd5743f 100644 --- a/vswitchd/brcompat.c +++ b/vswitchd/brcompat.c @@ -197,17 +197,10 @@ brc_write_config(struct svec *new_cfg) return 0; } -enum bmc_action { - BMC_ADD_DP, - BMC_DEL_DP, - BMC_ADD_PORT, - BMC_DEL_PORT -}; - /* Modify the existing configuration according to 'act'. The configuration * file will be modified to reflect these changes. The caller is * responsible for causing vswitchd to actually re-read its configuration. */ -static void +void brc_modify_config(const char *dp_name, const char *port_name, enum bmc_action act) { @@ -256,6 +249,8 @@ brc_modify_config(const char *dp_name, const char *port_name, brc_write_config(&new_cfg); svec_destroy(&new_cfg); + + cfg_read(); } static int @@ -267,7 +262,6 @@ brc_add_dp(const char *dp_name) brc_modify_config(dp_name, NULL, BMC_ADD_DP); - cfg_read(); bridge_reconfigure(); if (!bridge_exists(dp_name)) { @@ -286,7 +280,6 @@ brc_del_dp(const char *dp_name) brc_modify_config(dp_name, NULL, BMC_DEL_DP); - cfg_read(); bridge_reconfigure(); if (bridge_exists(dp_name)) { @@ -362,7 +355,6 @@ brc_handle_port_cmd(struct ofpbuf *buffer, bool add) } /* Force vswitchd to reconfigure itself. */ - cfg_read(); bridge_reconfigure(); return 0; diff --git a/vswitchd/brcompat.h b/vswitchd/brcompat.h index 17dd82c0..70d282ec 100644 --- a/vswitchd/brcompat.h +++ b/vswitchd/brcompat.h @@ -27,8 +27,19 @@ #ifndef VSWITCHD_BRCOMPAT_H #define VSWITCHD_BRCOMPAT_H 1 + +/* Actions to modify bridge compatibility configuration. */ +enum bmc_action { + BMC_ADD_DP, + BMC_DEL_DP, + BMC_ADD_PORT, + BMC_DEL_PORT +}; + void brc_init(const char *); void brc_wait(void); void brc_run(void); +void brc_modify_config(const char *dp_name, const char *port_name, + enum bmc_action act); #endif /* brcompat.h */ diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index f7a4672f..78a83504 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -40,6 +40,7 @@ #include #include #include "bitmap.h" +#include "brcompat.h" #include "cfg.h" #include "dirs.h" #include "dpif.h" @@ -1907,6 +1908,8 @@ phy_port_changed(struct bridge *br, enum ofp_port_reason reason, br->name, port->name); port_destroy(port); } + + brc_modify_config(br->name, (const char *)opp->name, BMC_DEL_PORT); bridge_flush(br); } else { if (port->n_ifaces > 1) {