9 # Customized per-interface setup, e.g. hyperv_vfup.hn1
12 # Comment this out, if this script is used as template
13 # for the customized per-interface setup.
15 if [ -f /usr/libexec/hyperv/hyperv_vfup.$1 ]
17 /usr/libexec/hyperv/hyperv_vfup.$1
24 hn_unit=`echo $hn | sed 's/[^0-9]*//g'`
26 vf=`sysctl -n dev.hn.$hn_unit.vf`
29 # Race happened; VF was removed, before we ran.
30 echo "$hn: VF was detached"
35 # Create laggX for hnX.
36 # Add VF and hnX to laggX.
41 ifconfig $lagg > /dev/null 2>&1
45 # No laggX, create it now.
47 ifconfig $lagg create > /dev/null 2>&1
50 echo "$lagg creation failed"
55 # Configure laggX (failover), add hnX and VF to it.
57 ifconfig $lagg laggproto failover laggport $hn laggport $vf
58 ifconfig $lagg inet6 no_dad
61 # Stop dhclient on hnX, if any.
63 pidfile=/var/run/dhclient.$hn.pid
66 kill -TERM `cat $pidfile`
70 # Remove all configured IPv4 addresses on hnX, e.g.
71 # configured by dhclient. laggX will take over the
76 ifconfig $hn -alias > /dev/null 2>&1
83 # TODO: Remove IPv6 addresses on hnX
86 # Use hnX's configuration for laggX
89 # If this script is used as template for the customized
90 # per-interface setup, replace this with whatever you
91 # want to do with the laggX.
103 ifconfig_args=`ifconfig_getargs $hn`
104 if [ -n "$ifconfig_args" ]
106 ifconfig $lagg $ifconfig_args
111 # laggX exists. Check whether VF was there or not.
112 # If VF was not added to laggX, add it now.
114 ifconfig $lagg | grep "laggport: $vf" > /dev/null 2>&1
117 ifconfig $lagg laggport $vf