X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fnetwork%2Fnetworkd-route.c;h=7f110a5217f1cdf7cca923b735ca8a3728f3fcad;hb=113b3fc1a8061f4a24dd0db74e9a3cd0083b2251;hp=4e389db5ef6194b1f45874e8a841ef870e43bfd1;hpb=9e7e440835c43d81ffdbc299d2c07daaa641ed50;p=elogind.git
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index 4e389db5e..7f110a521 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -19,15 +19,12 @@
along with systemd; If not, see .
***/
-#include
#include "networkd.h"
#include "networkd-link.h"
-#include "utf8.h"
#include "util.h"
#include "conf-parser.h"
-#include "network-internal.h"
int route_new_static(Network *network, unsigned section, Route **ret) {
_cleanup_route_free_ Route *route = NULL;
@@ -353,6 +350,12 @@ int config_parse_destination(const char *unit,
return 0;
}
+ if (f != AF_INET && f != AF_INET6) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "Unknown address family, ignoring assignment: %s", address);
+ return 0;
+ }
+
/* prefixlen */
if (e) {
r = safe_atou8(e + 1, &prefixlen);
@@ -362,7 +365,7 @@ int config_parse_destination(const char *unit,
return 0;
}
} else {
- switch (n->family) {
+ switch (f) {
case AF_INET:
prefixlen = 32;
break;
@@ -421,3 +424,44 @@ int config_parse_route_priority(const char *unit,
return 0;
}
+
+int config_parse_route_scope(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;
+
+ assert(filename);
+ assert(section);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ r = route_new_static(network, section_line, &n);
+ if (r < 0)
+ return r;
+
+ if (streq(rvalue, "host"))
+ n->scope = RT_SCOPE_HOST;
+ else if (streq(rvalue, "link"))
+ n->scope = RT_SCOPE_LINK;
+ else if (streq(rvalue, "global"))
+ n->scope = RT_SCOPE_UNIVERSE;
+ else {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "Unknown route scope: %s", rvalue);
+ return 0;
+ }
+
+ n = NULL;
+
+ return 0;
+}