aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/net.example.Linux.in14
-rw-r--r--net/Makefile2
-rw-r--r--net/bonding.sh2
-rw-r--r--net/bridge.sh2
-rw-r--r--net/ip6token.sh25
-rw-r--r--net/iproute2.sh2
6 files changed, 45 insertions, 2 deletions
diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index 84e4b1c..c117f4d 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -106,6 +106,16 @@
#config_eth0="192.168.0.2/24 scope host
#4321:0:1:2:3:4:567:89ab/64 nodad home preferred_lft 0"
+# Tokenized IPv6 addressing (as per ip-token(8)) is also possible. This will
+# grab the last 64 bits of the IP address below, and use that to auto-configure
+# IPv6 addresses, when using SLAAC. For example, given ::dead:beef below and an
+# advertised prefix of 100::/64 then Linux will configure an IPv6 address of
+# 100::dead:beef/64 on the interface. You can use "tail-end IPv4 addresses" too.
+#ip6token_eth0="::dead:beef"
+#ip6token_eth0="::192.168.0.1"
+#ip6token_eth0="::dead:beef:192.168.0.1"
+#ip6token_eth0="::ffff:192.168.0.1" # OK because the prefix won't be ::/64.
+
# Here's how to do routing if you need it
# We add an IPv4 default route, IPv4 subnet route and an IPv6 unicast route
#routes_eth0="default via 192.168.0.1
@@ -1350,6 +1360,10 @@
#
# Wireguard can also be configured by passing explicit settings
#wireguard_wg0="private-key /path/to/whatever listen-port 1234 peer ABCDEF= endpoint 1.2.3.4:2468"
+#
+# You must specify wireguard interface type to use arbitrary interface names
+#wireguard_site1="/path/to/site1.conf"
+#type_site1="wireguard"
# Network namespace support
# If an interface is configured with a network namespace, it will be moved
diff --git a/net/Makefile b/net/Makefile
index 22bd8d1..02c06fb 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -11,7 +11,7 @@ INC-FreeBSD= iwconfig.sh
SRCS-Linux= iwconfig.sh.in udhcpc.sh.in
INC-Linux= adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \
- ccwgroup.sh clip.sh ethtool.sh iproute2.sh ifplugd.sh ip6to4.sh \
+ ccwgroup.sh clip.sh ethtool.sh iproute2.sh iptoken.sh ifplugd.sh ip6to4.sh \
ipppd.sh iwconfig.sh netplugd.sh pppd.sh tuntap.sh udhcpc.sh \
vlan.sh macvlan.sh ip6rd.sh firewalld.sh dummy.sh hsr.sh l2tp.sh \
iw.sh iwd.sh wireguard.sh veth.sh dhclientv6.sh qmi.sh
diff --git a/net/bonding.sh b/net/bonding.sh
index e3fcaa7..bb8b061 100644
--- a/net/bonding.sh
+++ b/net/bonding.sh
@@ -133,6 +133,8 @@ bonding_pre_start()
for IFACE in ${slaves}; do
_delete_addresses
_down
+ local disable_ipv6="/proc/sys/net/ipv6/conf/${IFACE}/disable_ipv6"
+ [ -f "${disable_ipv6}" ] && printf '1\n' > "${disable_ipv6}"
done
fi
)
diff --git a/net/bridge.sh b/net/bridge.sh
index a380f6a..cea8a49 100644
--- a/net/bridge.sh
+++ b/net/bridge.sh
@@ -152,6 +152,8 @@ bridge_pre_start()
return 1
fi
# The interface is known to exist now
+ local disable_ipv6="/proc/sys/net/ipv6/conf/${IFACE}/disable_ipv6"
+ [ -f "${disable_ipv6}" ] && printf '1\n' > "${disable_ipv6}"
_up
if ${do_iproute2}; then
_netns ip link set "${x}" master "${BR_IFACE}"
diff --git a/net/ip6token.sh b/net/ip6token.sh
new file mode 100644
index 0000000..8b0ca31
--- /dev/null
+++ b/net/ip6token.sh
@@ -0,0 +1,25 @@
+# Copyright (c) 2024 Gentoo Authors
+
+ip6token_depend()
+{
+ program ip
+ after interface
+}
+
+_config_vars="$_config_vars ip6token"
+
+ip6token_pre_start()
+{
+ local tconfig
+ eval tconfig=\$ip6token_${IFVAR}
+
+ [ -z "${tconfig}" ] && return 0
+ ip token set "${tconfig}" dev "${IFACE}"
+ return $?
+}
+
+ip6token_post_stop()
+{
+ ip token del dev "${IFACE}"
+ return $?
+}
diff --git a/net/iproute2.sh b/net/iproute2.sh
index 7db7f5b..ca43496 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -290,7 +290,7 @@ _add_route()
# Process dev vs nodev routes
# Positional parameters are used for correct array handling
- if [[ -n ${rtype} ]]; then
+ if [ -n ${rtype} ]; then
local nodev_routes="$(service_get_value "nodev_routes")"
service_set_value "nodev_routes" "${nodev_routes}
${family} route del ${rtype} ${cmd}"