chiark / gitweb /
networkd: add support to configure IP Rule (#5725)
authorSusant Sahani <ssahani@users.noreply.github.com>
Thu, 14 Sep 2017 19:51:39 +0000 (19:51 +0000)
committerSven Eden <yamakuzure@gmx.net>
Mon, 25 Sep 2017 12:38:59 +0000 (14:38 +0200)
Routing Policy rule manipulates rules in the routing policy database control the
route selection algorithm.

This work supports to configure Rule
```
[RoutingPolicyRule]
TypeOfService=0x08
Table=7
From= 192.168.100.18

```

```
ip rule show
0: from all lookup local
0: from 192.168.100.18 tos 0x08 lookup 7
```

V2 changes:

1. Added logic to handle duplicate rules.
2. If rules are changed or deleted and networkd restarted
   then those are deleted when networkd restarts next time

V3:

1. Add parse_fwmark_fwmask

src/basic/missing.h

index 0a140bbe940b402b397bd6eb8a242eea06fb0b38..2581920a812963ba7f2042b2cf08e57b8e02c09e 100644 (file)
@@ -927,6 +927,33 @@ struct input_mask {
 #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
 #endif
 
+#if !HAVE_DECL_FRA_UID_RANGE
+#define FRA_UNSPEC 0
+#define FRA_DST 1
+#define FRA_SRC 2
+#define FRA_IIFNAME 3
+#define FRA_GOTO 4
+#define FRA_UNUSED2 5
+#define FRA_PRIORITY 6
+#define FRA_UNUSED3 7
+#define FRA_UNUSED4 8
+#define FRA_UNUSED5 9
+#define FRA_FWMARK 10
+#define FRA_FLOW 11
+#define FRA_TUN_ID 12
+#define FRA_SUPPRESS_IFGROUP 13
+#define FRA_SUPPRESS_PREFIXLEN 14
+#define FRA_TABLE 15
+#define FRA_FWMASK 16
+#define FRA_OIFNAME 17
+#define FRA_PAD 18
+#define FRA_L3MDEV 19
+#define FRA_UID_RANGE 20
+#define __FRA_MAX 12
+
+#define FRA_MAX (__FRA_MAX - 1)
+#endif
+
 #if !HAVE_DECL_IFLA_BRPORT_PROXYARP
 #define IFLA_BRPORT_PROXYARP 10
 #endif
@@ -1227,6 +1254,15 @@ struct ethtool_link_settings {
 #endif
 #endif // 0
 
+#ifndef HAVE_STRUCT_FIB_RULE_UID_RANGE
+
+struct fib_rule_uid_range {
+        __u32 start;
+        __u32 end;
+};
+
+#endif
+
 #endif
 
 #ifndef SOL_ALG