Skip to content

Commit

Permalink
fix: Make regex for special address ranges more strict (#2315)
Browse files Browse the repository at this point in the history
Successfully filters out `::1` and `fe80...`, and lets `...fe80...` and
`...::1...` through.
```
% cat demo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
    inet6 fe80:a424:8eec:696f:de9a:532b:bbad:f0d7/64 scope link
       valid_lft forever preferred_lft forever
    inet6 a550:fe80:8eec:696f:de9a:532b:bbad:f0d7/64 scope global
       valid_lft forever preferred_lft forever
    inet6 a550:a424:8eec:696f:de9a:532b::1/64 scope global
       valid_lft forever preferred_lft forever
```

```
% cat demo | awk '(/inet6/) && (!/\sfe80|\s::1/) { print $2 }'
a550:fe80:8eec:696f:de9a:532b:bbad:f0d7/64
a550:a424:8eec:696f:de9a:532b::1/64
```
  • Loading branch information
Bownairo authored Oct 29, 2024
1 parent 5c85e7d commit dac2f36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ic-os/components/setupos-scripts/check-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function get_network_settings() {

# Full IPv6 address
ipv6_address_system_full=$(eval_command_with_retries \
"ip -6 addr show | awk '(/inet6/) && (!/fe80|::1/) { print \$2 }'" \
"ip -6 addr show | awk '(/inet6/) && (!/\sfe80|\s::1/) { print \$2 }'" \
"Failed to get system's network configuration.")

if [ -z "${ipv6_address_system_full}" ]; then
Expand Down

0 comments on commit dac2f36

Please sign in to comment.