diff --git a/README.md b/README.md index b381a61..60cbf78 100644 --- a/README.md +++ b/README.md @@ -291,6 +291,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **11.02.21:** - Fix bug related to changing internal subnet and named peer confs not updating. * **06.10.20:** - Disable CoreDNS in client mode, or if port 53 is already in use in server mode. * **04.10.20:** - Allow to specify a list of names as PEERS and add ALLOWEDIPS environment variable. Also, add peer name/id to each one of the peer sections in wg0.conf. Important: Existing users need to delete `/config/templates/peer.conf` and restart * **27.09.20:** - Cleaning service binding example to have accurate PreDown script. diff --git a/readme-vars.yml b/readme-vars.yml index 63d2f74..fb5fa2f 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -103,6 +103,7 @@ app_setup_block: | # changelog changelogs: + - { date: "11.02.21:", desc: "Fix bug related to changing internal subnet and named peer confs not updating." } - { date: "06.10.20:", desc: "Disable CoreDNS in client mode, or if port 53 is already in use in server mode." } - { date: "04.10.20:", desc: "Allow to specify a list of names as PEERS and add ALLOWEDIPS environment variable. Also, add peer name/id to each one of the peer sections in wg0.conf. Important: Existing users need to delete `/config/templates/peer.conf` and restart" } - { date: "27.09.20:", desc: "Cleaning service binding example to have accurate PreDown script." } diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config index 724d24b..7bf238c 100644 --- a/root/etc/cont-init.d/30-config +++ b/root/etc/cont-init.d/30-config @@ -185,10 +185,13 @@ DUDE" fi if [ -f "/config/${PEER_ID}/${PEER_ID}.conf" ]; then CLIENT_IP=$(cat /config/${PEER_ID}/${PEER_ID}.conf | grep "Address" | awk '{print $NF}') + if [ -n "${ORIG_INTERFACE}" ] && [ "${INTERFACE}" != "${ORIG_INTERFACE}" ]; then + CLIENT_IP=$(echo "${CLIENT_IP}" | sed "s|${ORIG_INTERFACE}|${INTERFACE}|") + fi else for idx in {2..254}; do PROPOSED_IP="${INTERFACE}.${idx}" - if ! grep -q -R "${PROPOSED_IP}" /config/peer*/*.conf; then + if ! grep -q -R "${PROPOSED_IP}" /config/peer*/*.conf && ([ -z "${ORIG_INTERFACE}" ] || ! grep -q -R "${ORIG_INTERFACE}.${idx}" /config/peer*/*.conf); then CLIENT_IP="${PROPOSED_IP}" break fi