]> git.ipfire.org Git - people/arne_f/network.git/blobdiff - hooks/zones/bridge.configs/ipv4-static
network: Improve IPV4 support.
[people/arne_f/network.git] / hooks / zones / bridge.configs / ipv4-static
index f1fc2d6ade39acee9cae69d75a83592b3cd1147f..5793321c9a9bb3fa5c3019359dda8c9a53209b2b 100755 (executable)
@@ -78,9 +78,16 @@ function _up() {
        config_read $(zone_dir ${zone})/configs/${config}
 
        if ! zone_has_ipv4 ${zone} ${ADDRESS}/${PREFIX}; then
+               if ipv4_detect_duplicate ${zone} ${ADDRESS}; then
+                       error_log "Duplicate address detected on zone '${zone}' (${address})."
+                       error_log "Cannot continue."
+                       exit ${EXIT_ERROR}
+               fi
+
                ip addr add ${ADDRESS}/${PREFIX} dev ${zone}
-       else
-               warning "Do not set IPv4 address '${ADDRESS}/${PREFIX}' because it was already configured on zone '${zone}'."
+
+               # Announce our new address to the neighbours
+               ipv4_update_neighbours ${zone} ${ADDRESS}
        fi
 
        if zone_is_nonlocal ${zone} && [ -n "${GATEWAY}" ]; then