summaryrefslogtreecommitdiff
path: root/src/network/networkd-route.c
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@users.noreply.github.com>2017-04-25 13:02:59 +0530
committerLennart Poettering <lennart@poettering.net>2017-04-25 09:32:59 +0200
commitb5bf6f645e83f279e3a048f3eb62475420a1af20 (patch)
tree57216aea03f6a33d6409d2d4884d631f45762948 /src/network/networkd-route.c
parent19fe49f62cc916f1237ea92a04fc80ee75285dde (diff)
networkd: make IPv6 route preference configurable (#5700)
The work supports route preference configurable. i.e. able to set low, medium and high.
Diffstat (limited to 'src/network/networkd-route.c')
-rw-r--r--src/network/networkd-route.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index e2a5c77ed1..56f831628c 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -17,6 +17,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <linux/icmpv6.h>
+
#include "alloc-util.h"
#include "conf-parser.h"
#include "in-addr-util.h"
@@ -975,6 +977,35 @@ int config_parse_gateway_onlink(const char *unit,
n->flags |= RTNH_F_ONLINK;
else
n->flags &= ~RTNH_F_ONLINK;
+ n = NULL;
+
+ return 0;
+}
+
+int config_parse_ipv6_route_preference(const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+ Network *network = userdata;
+ _cleanup_route_free_ Route *n = NULL;
+ int r;
+
+ if (streq(rvalue, "low"))
+ n->pref = ICMPV6_ROUTER_PREF_LOW;
+ else if (streq(rvalue, "medium"))
+ n->pref = ICMPV6_ROUTER_PREF_MEDIUM;
+ else if (streq(rvalue, "high"))
+ n->pref = ICMPV6_ROUTER_PREF_HIGH;
+ else {
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Unknown route preference: %s", rvalue);
+ return 0;
+ }
n = NULL;