# vim:ft=sh:noexpandtab # Bridge with dhcpd # TODO FreeBSD BRIDGE_NET_BRIDGE="./files/bridge_net/bridge.service" BRIDGE_NET_SYSCTL="./files/bridge_net/sysctl.conf" BRIDGE_NET_DHCPD="./files/bridge_net/dhcpd.conf" BRIDGE_NET_BRIDGE_DHCP="./files/bridge_net/bridge-dhcp.service" bridge_net_check() { ops_set_current bridge_net if ! ( which dhcpd ) >/dev/null; then echo_error "Bridge_net expects dhcpd to be installed" return 0 fi # TODO check that we are using openrc otherwise this doesn't work # Setup bridge service if do_diff "$BRIDGE_NET_BRIDGE" "/etc/init.d/bridge" \ "Bridge service changes"; then ops_require bridge_service fi # Setup ipv4 forward if do_diff "$BRIDGE_NET_SYSCTL" "/etc/sysctl.d/bridge_net.conf" \ "Sysctl changes"; then ops_require sysctl fi # DHCPd service if do_diff "$BRIDGE_NET_BRIDGE_DHCP" "/etc/init.d/bridge-dhcp" \ "Bridge dhcp service changes"; then ops_require bridge_dhcp_service fi # DHCPd configuration if do_diff "$BRIDGE_NET_DHCPD" "/etc/dhcp/bridge_dhcpd.conf" \ "DHCPD configuration changes"; then ops_require dhcpd_conf fi # TODO enable bridge_dhcp and bridge service ops_required_any "Bridge_net" # return 1 fall trough } bridge_net_prepare() { local BRIDGE_RESTART=false if ops_is_required bridge_service; then echo_trace "Updating bridge service" cp "$BRIDGE_NET_BRIDGE" "/etc/init.d/bridge" BRIDGE_RESTART=true fi if ops_is_required sysctl; then echo_trace "Updating sysctl configuration for bridge" cp "$BRIDGE_NET_SYSCTL" "/etc/sysctl.d/bridge" fi if $BRIDGE_RESTART; then service bridge restart fi } bridge_net_apply() { # We have nothing to do for apply # TODO true } bridge_net_clean() { # We have nothing to do for clean # TODO true }