Last active
May 6, 2017 04:31
-
-
Save firefish5000/2c6dbf3b485bba7620874a225ad8af69 to your computer and use it in GitHub Desktop.
Funtoo ip token set support. Dynamic prefix, static host. Using Delegated prefix with a static host.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#/etc/netif.d/interface-tokenized | |
netif_pre_up() { | |
local count=-1 | |
local label | |
local bcast | |
for ipnm in $ipaddr $ipaddrs; do | |
if [ $count -ge 0 ] | |
then | |
label=$interface:$count | |
else | |
label="" | |
fi | |
if [ -n "$(if_ipv4 $ipnm)" ] | |
then | |
bcast="broadcast $(get_option "$ipnm" broadcast +)" | |
else | |
bcast="" | |
fi | |
if [ -z "$label" ] | |
then | |
ip addr add $(get_ipnm_part "$ipnm") $bcast \ | |
dev $interface || die "Couldn't add $ipnm to $interface" | |
else | |
ip addr add $(get_ipnm_part "$ipnm") $bcast \ | |
label $label dev $interface || die "Couldn't add $ipnm to $interface" | |
fi | |
count=$(( $count + 1 )) | |
done | |
if [ -n "$ip6token" ] | |
then | |
try ip token set "$ip6token" dev "$interface" | |
fi | |
} | |
netif_post_down() { | |
try ip token del dev "$interface" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/conf.d/netif.enp0s1 | |
template="interface-tokenized" | |
# Use ::53 for the host portion of the address. | |
# If the Prefix given is 2001:db8:feed:1::/64 | |
# Then your address will be 2001:db8:feed:1::53/64 | |
# Note iproute2 only supports 1 token per interface ATM. | |
ip6token="::53/64" | |
# For more information about ipv6 tokens, read the man page | |
# for 'ip-token' or the refrenced draft-chown-6man-tokenised-ipv6-identifiers-02 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment