]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/routing-policy-rule: reorder elements of RoutingPolicyRule and add comments
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 17 Aug 2024 06:25:04 +0000 (15:25 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 19 Aug 2024 17:21:21 +0000 (02:21 +0900)
No functional change, just refactoring.

src/network/networkd-routing-policy-rule.h

index 60524c00a0c93b0463e27a47f8e8fd8a1f13ff8a..23aa041180c88fc33721b0c8ade67d87b8b51b51 100644 (file)
@@ -20,37 +20,36 @@ typedef struct RoutingPolicyRule {
         NetworkConfigSource source;
         NetworkConfigState state;
 
-        bool invert_rule;
+        /* struct fib_rule_hdr */
+        AddressFamily address_family; /* Specified by Family= */
+        int family; /* Automatically determined by From= or To= */
+        uint8_t to_prefixlen;
+        uint8_t from_prefixlen;
+        uint8_t tos;
+        uint8_t type; /* a.k.a action */
+        bool invert_rule; /* used for flags */
+
+        /* attributes */
+        union in_addr_union to; /* FRA_DST */
+        union in_addr_union from; /* FRA_SRC */
+        char *iif; /* FRA_IIFNAME */
+        /* FRA_GOTO */
         bool priority_set;
+        uint32_t priority; /* FRA_PRIORITY */
+        uint32_t fwmark; /* FRA_FWMARK */
+        /* FRA_FLOW */
+        /* FRA_TUN_ID */
+        int32_t suppress_ifgroup; /* FRA_SUPPRESS_IFGROUP */
+        int suppress_prefixlen; /* FRA_SUPPRESS_PREFIXLEN */
+        uint32_t table; /* FRA_TABLE, also used in struct fib_rule_hdr */
+        uint32_t fwmask; /* FRA_FWMASK */
+        char *oif; /* FRA_OIFNAME */
         bool l3mdev; /* FRA_L3MDEV */
-
-        uint8_t tos;
-        uint8_t type;
-        uint8_t ipproto; /* FRA_IP_PROTO */
+        struct fib_rule_uid_range uid_range; /* FRA_UID_RANGE */
         uint8_t protocol; /* FRA_PROTOCOL */
-        uint8_t to_prefixlen;
-        uint8_t from_prefixlen;
-
-        uint32_t table;
-        uint32_t fwmark;
-        uint32_t fwmask;
-        uint32_t priority;
-
-        AddressFamily address_family; /* Specified by Family= */
-        int family; /* Automatically determined by From= or To= */
-
-        char *iif;
-        char *oif;
-
-        union in_addr_union to;
-        union in_addr_union from;
-
-        struct fib_rule_port_range sport;
-        struct fib_rule_port_range dport;
-        struct fib_rule_uid_range uid_range;
-
-        int suppress_prefixlen;
-        int32_t suppress_ifgroup;
+        uint8_t ipproto; /* FRA_IP_PROTO */
+        struct fib_rule_port_range sport; /* FRA_SPORT_RANGE */
+        struct fib_rule_port_range dport; /* FRA_DPORT_RANGE */
 } RoutingPolicyRule;
 
 const char* fr_act_type_full_to_string(int t) _const_;