diff options
author | Phil Sutter <phil@nwl.cc> | 2021-11-05 18:50:21 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2021-11-23 15:01:23 +0100 |
commit | e5fb9f8efaa0643a566d079c8201082822a0dc81 (patch) | |
tree | 69e09ca9df14c500c707499badcb3058708752b8 /iptables/nft-ipv6.c | |
parent | 22f2e1fca127b014dccf1006544e3179c9dc9764 (diff) |
xshared: Share save_ipv{4,6}_addr() with legacy
While being at it, make save_ipv4_addr() accept an in_addr* as mask -
mask_to_str() needs it anyway.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/nft-ipv6.c')
-rw-r--r-- | iptables/nft-ipv6.c | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/iptables/nft-ipv6.c b/iptables/nft-ipv6.c index 0c73cedd..0b35e045 100644 --- a/iptables/nft-ipv6.c +++ b/iptables/nft-ipv6.c @@ -224,26 +224,6 @@ static void nft_ipv6_print_rule(struct nft_handle *h, struct nftnl_rule *r, nft_clear_iptables_command_state(&cs); } -static void save_ipv6_addr(char letter, const struct in6_addr *addr, - const struct in6_addr *mask, - int invert) -{ - char addr_str[INET6_ADDRSTRLEN]; - int l = xtables_ip6mask_to_cidr(mask); - - if (!invert && l == 0) - return; - - printf("%s -%c %s", - invert ? " !" : "", letter, - inet_ntop(AF_INET6, addr, addr_str, sizeof(addr_str))); - - if (l == -1) - printf("/%s", inet_ntop(AF_INET6, mask, addr_str, sizeof(addr_str))); - else - printf("/%d", l); -} - static void nft_ipv6_save_rule(const void *data, unsigned int format) { const struct iptables_command_state *cs = data; |