Merge pull request #96 from linuxserver/peers

change ip when subnet changes
This commit is contained in:
aptalca 2021-02-15 09:49:52 -05:00 committed by GitHub
commit d23cb716b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -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.

View File

@ -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." }

View File

@ -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