From: Ben Pfaff Date: Mon, 27 Apr 2009 22:05:24 +0000 (-0700) Subject: vswitch: Don't bring up interfaces when adding them to datapaths. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=720e26aa69585516ef441406a7d7ea46f423bd20;p=openvswitch vswitch: Don't bring up interfaces when adding them to datapaths. Xen expects that the bridge doesn't bring up interfaces when they get added to a datapath, so bringing them up in our emulation was causing problems on XenServer. Keith in particular reports that this commit fixed boot on XenServer when the management interface was configured to get an IP address via DHCP. This change might cause trouble or surprise for other users who do expect interfaces to be brought up when added to a vswitch, but Keith didn't see any new problems on XenServer. Bug #1259. --- diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 847ce26e..684eaaaf 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -196,7 +196,6 @@ enum { DP_MAX = 256 }; static struct bridge *bridge_create(const char *name); static void bridge_destroy(struct bridge *); static struct bridge *bridge_lookup(const char *name); -static int if_up(const char *netdev_name); static int bridge_run_one(struct bridge *); static void bridge_reconfigure_one(struct bridge *); static void bridge_get_all_ifaces(const struct bridge *, struct svec *ifaces); @@ -440,7 +439,6 @@ bridge_reconfigure(void) next_port_no = 1; for (i = 0; i < add_ifaces.n; i++) { const char *if_name = add_ifaces.names[i]; - if_up(if_name); for (;;) { int error = dpif_port_add(&br->dpif, if_name, next_port_no++); if (error != EEXIST) { @@ -844,20 +842,6 @@ bridge_get_datapathid(const char *name) return br ? ofproto_get_datapath_id(br->ofproto) : 0; } -static int -if_up(const char *netdev_name) -{ - struct netdev *netdev; - int retval; - - retval = netdev_open(netdev_name, NETDEV_ETH_TYPE_NONE, &netdev); - if (!retval) { - retval = netdev_turn_flags_on(netdev, NETDEV_UP, true); - netdev_close(netdev); - } - return retval; -} - static int bridge_run_one(struct bridge *br) { @@ -1005,13 +989,13 @@ bridge_reconfigure_one(struct bridge *br) error = netdev_open(br->name, NETDEV_ETH_TYPE_NONE, &netdev); if (!error) { - netdev_turn_flags_on(netdev, NETDEV_UP, true); if (cfg_is_valid(CFG_IP | CFG_REQUIRED, "%s.ip", pfx)) { struct in_addr ip, mask, gateway; ip.s_addr = cfg_get_ip(0, "%s.ip", pfx); mask.s_addr = cfg_get_ip(0, "%s.netmask", pfx); gateway.s_addr = cfg_get_ip(0, "%s.gateway", pfx); + netdev_turn_flags_on(netdev, NETDEV_UP, true); if (!mask.s_addr) { mask.s_addr = guess_netmask(ip.s_addr); }