Skip to content

Commit

Permalink
semi-automated PD on raspbian scripts: support of debian platform for…
Browse files Browse the repository at this point in the history
… latest Raspi OS
  • Loading branch information
yangsong-cnyn committed Oct 11, 2024
1 parent 547e0f2 commit 11e3318
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions examples/platforms/debian/default
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
NAT64=0
DNS64=0
DHCPV6_PD=0
DHCPV6_PD_REF=1
NETWORK_MANAGER=0
BACKBONE_ROUTER=1
BORDER_ROUTING=1
Expand Down
1 change: 0 additions & 1 deletion script/_border_routing
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ dhcpcd_disable_ipv6()
if [ -f $DHCPCD_CONF_FILE ]; then
sudo cp $DHCPCD_CONF_FILE $DHCPCD_CONF_BACKUP_FILE
sudo tee -a $DHCPCD_CONF_FILE <<EOF
noipv6
noipv6rs
EOF
fi
Expand Down
5 changes: 5 additions & 0 deletions script/_dhcpv6_pd_ref
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ interface eth0
ipv6rs
iaid 1
ia_pd 2/::/64 -
interface wlan0
ipv6rs
iaid 2
ia_pd 3/::/64 -
EOF
}

Expand Down
6 changes: 6 additions & 0 deletions script/_otbr
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ otbr_install()
)
fi

if with DHCPV6_PD_REF; then
otbr_options+=(
"-DOTBR_DHCP6_PD=ON"
)
fi

if with REST_API; then
otbr_options+=("-DOTBR_REST=ON")
fi
Expand Down
2 changes: 1 addition & 1 deletion script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ install_packages_apt()
}

# dhcpv6 pd
with DHCPV6_PD_REF && if [[ $PLATFORM == "raspbian" ]]; then
with DHCPV6_PD_REF && if command -v apt-get &>/dev/null; then
sudo apt-get install --no-install-recommends -y dhcpcd
sudo mkdir -p /etc/systemd/system/dhcpcd.service.d
# allow edit system config file eg. /etc/radvd.conf
Expand Down
6 changes: 4 additions & 2 deletions script/reference-device/dhcpcd.enter-hook
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/bin/bash

WAN_INTERFACE="eth0"
WLAN_INTERFACE="wlan0"
WPAN_INTERFACE="wpan0"

RADVD_CONF="/etc/radvd.conf"
LOG_TAG="dhcpcd.enter.hook:"


config_ra()
{
logger -t "$LOG_TAG $reason start config radvd"
logger "$LOG_TAG $reason start config radvd"

sudo tee "${RADVD_CONF}" > /dev/null <<EOF
interface ${WPAN_INTERFACE}
Expand All @@ -27,7 +29,7 @@ EOF
}


if [ "${interface}" = "eth0" ]; then
if [ "${interface}" = "eth0" ] || [ “${interface}= “wlan0” ]; then

for var in $(env); do
# Split the variable into name and value
Expand Down
7 changes: 4 additions & 3 deletions script/reference-device/dhcpcd.exit-hook
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@


WAN_INTERFACE="eth0"
WLAN_INTERFACE="wlan0"
WPAN_INTERFACE="wpan0"

RADVD_CONF="/etc/radvd.conf"
LOG_TAG="dhcpcd.exit.hook:"

config_ra()
{
logger -t "$LOG_TAG $reason start config radvd"
logger "$LOG_TAG $reason start config radvd"

sudo tee "${RADVD_CONF}" > /dev/null <<EOF
interface ${WPAN_INTERFACE}
Expand All @@ -28,7 +29,7 @@ interface ${WPAN_INTERFACE}
EOF
}

if [ “${interface}= “eth0” ]; then
if [ “${interface}= “eth0” ] || [ “${interface}= “wlan0” ]; then

for var in $(env); do
# Split the variable into name and value
Expand All @@ -40,7 +41,7 @@ if [ “${interface}” = “eth0” ]; then

case $reason in
EXPIRE6 | STOP6)
config_ra $old_dhcp6_ia_pd1_prefix1 $old_dhcp6_ia_pd1_prefix1 0 0
config_ra $old_dhcp6_ia_pd1_prefix1 $old_dhcp6_ia_pd1_prefix1_length 0 0
sudo systemctl restart radvd
;;
esac
Expand Down

0 comments on commit 11e3318

Please sign in to comment.