]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: address: reuse Address:ip_masquerade_done for IPv6 case
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 17 Feb 2021 07:06:31 +0000 (16:06 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 19 Feb 2021 05:22:32 +0000 (14:22 +0900)
It is not necessary to use different flag for each address family.

Follow-up for 48ed276647c754bfb3ed5c6c5af9404e073ffe54.

src/network/networkd-address.c
src/network/networkd-address.h

index f55f9fafbe722b550d651dfac36b11159d69d4d6..566709b3715d5c89ee024e9ad00aa6591e7a8843 100644 (file)
@@ -276,12 +276,7 @@ static int address_set_masquerade(Address *address, bool add) {
         if (address->scope >= RT_SCOPE_LINK)
                 return 0;
 
-        if (address->family == AF_INET &&
-            address->ip_masquerade_done == add)
-                return 0;
-
-        if (address->family == AF_INET6 &&
-            address->ipv6_masquerade_done == add)
+        if (address->ip_masquerade_done == add)
                 return 0;
 
         masked = address->in_addr;
@@ -293,10 +288,7 @@ static int address_set_masquerade(Address *address, bool add) {
         if (r < 0)
                 return r;
 
-        if (address->family == AF_INET)
-                address->ip_masquerade_done = add;
-        else if (address->family == AF_INET6)
-                address->ipv6_masquerade_done = add;
+        address->ip_masquerade_done = add;
 
         return 0;
 }
index d50c5a77f52f3be2dc005e7af26683d010a37641..7c2d0db3d07f6a0a1adc31176a2c54ed4056eb60 100644 (file)
@@ -38,7 +38,6 @@ typedef struct Address {
 
         bool scope_set:1;
         bool ip_masquerade_done:1;
-        bool ipv6_masquerade_done:1;
         AddressFamily duplicate_address_detection;
 
         /* Called when address become ready */