X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fnetwork%2Fnetworkd-route.c;h=10d8cd902a8c16147eb52bb4aa0d01781054ed1b;hp=77c2daddc50f052339062812b332aa2263d83606;hb=3f85ef0f05ffc51e19f86fb83a1c51e8e3cd6817;hpb=44e7b9492617408130d11ffa451c2660942974f6 diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 77c2daddc..10d8cd902 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -22,6 +22,7 @@ #include #include "networkd.h" +#include "networkd-link.h" #include "utf8.h" #include "util.h" @@ -143,6 +144,17 @@ int route_drop(Route *route, Link *link, } } + if (!in_addr_is_null(route->family, &route->prefsrc_addr)) { + if (route->family == AF_INET) + r = sd_rtnl_message_append_in_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in); + else if (route->family == AF_INET6) + r = sd_rtnl_message_append_in6_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in6); + if (r < 0) { + log_error("Could not append RTA_PREFSRC attribute: %s", strerror(-r)); + return r; + } + } + r = sd_rtnl_message_route_set_scope(req, route->scope); if (r < 0) { log_error("Could not set scope: %s", strerror(-r)); @@ -217,6 +229,17 @@ int route_configure(Route *route, Link *link, } } + if (!in_addr_is_null(route->family, &route->prefsrc_addr)) { + if (route->family == AF_INET) + r = sd_rtnl_message_append_in_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in); + else if (route->family == AF_INET6) + r = sd_rtnl_message_append_in6_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in6); + if (r < 0) { + log_error("Could not append RTA_PREFSRC attribute: %s", strerror(-r)); + return r; + } + } + r = sd_rtnl_message_route_set_scope(req, route->scope); if (r < 0) { log_error("Could not set scope: %s", strerror(-r));