chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sd-rtnl: message_open_container - don't take a 'size' argument
[elogind.git]
/
src
/
network
/
networkd-route.c
diff --git
a/src/network/networkd-route.c
b/src/network/networkd-route.c
index 3eaefa2cc741ffa42e84da99acdd2065d2be1613..098539ed19c8a147f15481689fa2a958edf6c5ea 100644
(file)
--- a/
src/network/networkd-route.c
+++ b/
src/network/networkd-route.c
@@
-28,7
+28,7
@@
#include "conf-parser.h"
#include "net-util.h"
#include "conf-parser.h"
#include "net-util.h"
-int route_new(Network *network, unsigned section, Route **ret) {
+int route_new
_static
(Network *network, unsigned section, Route **ret) {
_cleanup_route_free_ Route *route = NULL;
if (section) {
_cleanup_route_free_ Route *route = NULL;
if (section) {
@@
-47,9
+47,11
@@
int route_new(Network *network, unsigned section, Route **ret) {
if (!route)
return -ENOMEM;
if (!route)
return -ENOMEM;
+ route->family = AF_UNSPEC;
+
route->network = network;
route->network = network;
- LIST_PREPEND(
routes, network->
routes, route);
+ LIST_PREPEND(
static_routes, network->static_
routes, route);
if (section) {
route->section = section;
if (section) {
route->section = section;
@@
-62,22
+64,39
@@
int route_new(Network *network, unsigned section, Route **ret) {
return 0;
}
return 0;
}
+int route_new_dynamic(Route **ret) {
+ _cleanup_route_free_ Route *route = NULL;
+
+ route = new0(Route, 1);
+ if (!route)
+ return -ENOMEM;
+
+ route->family = AF_UNSPEC;
+
+ *ret = route;
+ route = NULL;
+
+ return 0;
+}
+
void route_free(Route *route) {
if (!route)
return;
void route_free(Route *route) {
if (!route)
return;
- LIST_REMOVE(routes, route->network->routes, route);
+ if (route->network) {
+ LIST_REMOVE(static_routes, route->network->static_routes, route);
- if (route->section)
- hashmap_remove(route->network->routes_by_section,
- &route->section);
+ if (route->section)
+ hashmap_remove(route->network->routes_by_section,
+ &route->section);
+ }
free(route);
}
int route_configure(Route *route, Link *link,
sd_rtnl_message_handler_t callback) {
free(route);
}
int route_configure(Route *route, Link *link,
sd_rtnl_message_handler_t callback) {
- _cleanup_
sd_
rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
int r;
assert(link);
int r;
assert(link);
@@
-86,7
+105,7
@@
int route_configure(Route *route, Link *link,
assert(link->ifindex > 0);
assert(route->family == AF_INET || route->family == AF_INET6);
assert(link->ifindex > 0);
assert(route->family == AF_INET || route->family == AF_INET6);
- r = sd_rtnl_message_
route_new
(RTM_NEWROUTE, route->family, &req);
+ r = sd_rtnl_message_
new_route
(RTM_NEWROUTE, route->family, &req);
if (r < 0) {
log_error("Could not create RTM_NEWROUTE message: %s", strerror(-r));
return r;
if (r < 0) {
log_error("Could not create RTM_NEWROUTE message: %s", strerror(-r));
return r;
@@
-160,7
+179,7
@@
int config_parse_gateway(const char *unit,
section_line = 0;
}
section_line = 0;
}
- r = route_new(network, section_line, &n);
+ r = route_new
_static
(network, section_line, &n);
if (r < 0)
return r;
if (r < 0)
return r;
@@
-198,7
+217,7
@@
int config_parse_destination(const char *unit,
assert(rvalue);
assert(data);
assert(rvalue);
assert(data);
- r = route_new(network, section_line, &n);
+ r = route_new
_static
(network, section_line, &n);
if (r < 0)
return r;
if (r < 0)
return r;