diff options
Diffstat (limited to 'src/firejail/network.c')
-rw-r--r-- | src/firejail/network.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/firejail/network.c b/src/firejail/network.c index 80f150ea0..5ebaf873c 100644 --- a/src/firejail/network.c +++ b/src/firejail/network.c | |||
@@ -28,6 +28,21 @@ | |||
28 | #include <net/route.h> | 28 | #include <net/route.h> |
29 | #include <linux/if_bridge.h> | 29 | #include <linux/if_bridge.h> |
30 | 30 | ||
31 | // return 1 if addr is a IPv4 or IPv6 address | ||
32 | int check_ip46_address(const char *addr) { | ||
33 | // check ipv4 address | ||
34 | uint32_t tmp; | ||
35 | if (atoip(addr, &tmp) == 0) | ||
36 | return 1; | ||
37 | |||
38 | // check ipv6 address | ||
39 | struct in6_addr result; | ||
40 | if (inet_pton(AF_INET6, addr, &result) == 1) | ||
41 | return 1; | ||
42 | |||
43 | // failed | ||
44 | return 0; | ||
45 | } | ||
31 | 46 | ||
32 | int net_get_mtu(const char *ifname) { | 47 | int net_get_mtu(const char *ifname) { |
33 | int mtu = 0; | 48 | int mtu = 0; |