From: Ben Pfaff Date: Wed, 26 Nov 2008 19:38:28 +0000 (-0800) Subject: Add DATAPATH_ID to switch packaging, to enable persistent DPIDs. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72ce961ebb76cb3bcdd326aff682a45339302f3c;p=openvswitch Add DATAPATH_ID to switch packaging, to enable persistent DPIDs. --- diff --git a/debian/openflow-switch.default b/debian/openflow-switch.default index 9529ddf3..7eedab52 100644 --- a/debian/openflow-switch.default +++ b/debian/openflow-switch.default @@ -122,3 +122,13 @@ DAEMON_OPTS="" # will disable core dumps. Setting it to "unlimited" will dump all # core files regardless of size. #CORE_LIMIT=unlimited + +# DATAPATH_ID: Identifier for this switch. +# +# By default, the switch generates a new, random datapath ID every time +# it starts up. By setting this value, the datapath ID will be consistent +# from one run to the next. +# +# Set DATAPATH_ID to a MAC address in the form XX:XX:XX:XX:XX:XX where each +# X is a hexadecimal digit (0-9 or a-f). +#DATAPATH_ID=XX:XX:XX:XX:XX:XX diff --git a/debian/openflow-switch.init b/debian/openflow-switch.init index 9b8acf6a..fa17d2ba 100755 --- a/debian/openflow-switch.init +++ b/debian/openflow-switch.init @@ -46,6 +46,7 @@ unset MGMT_VCONNS unset COMMANDS unset DAEMON_OPTS unset CORE_LIMIT +unset DATAPATH_ID default=/etc/default/openflow-switch if [ -f $default ] ; then . $default @@ -222,6 +223,20 @@ case "$1" in must_succeed "Adding $netdev to datapath" dpctl addif nl:0 $netdev done + xx='[0-9abcdefABCDEF][0-9abcdefABCDEF]' + case $DATAPATH_ID in + '') + ;; + $xx:$xx:$xx:$xx:$xx:$xx) + ifconfig of0 down + must_succeed "Setting of0 MAC address to $DATAPATH_ID" ifconfig of0 hw ether $DATAPATH_ID + ifconfig of0 up + ;; + *) + echo "DATAPATH_ID is not a valid MAC address in the form XX:XX:XX:XX:XX:XX, ignoring" >&2 + ;; + esac + if test "$MODE" = in-band; then if test "$SWITCH_IP" = dhcp; then must_succeed "Temporarily disabling of0" ifconfig of0 down