chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Unify parse_argv style
[elogind.git]
/
src
/
network
/
networkd-route.c
diff --git
a/src/network/networkd-route.c
b/src/network/networkd-route.c
index 8949299409f476aead74fca52037049b309a60fd..f451b975a701bb9b7ed1ecb337a8c55939f078b5 100644
(file)
--- a/
src/network/networkd-route.c
+++ b/
src/network/networkd-route.c
@@
-32,9
+32,8
@@
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) {
- uint64_t key = section;
-
- route = hashmap_get(network->routes_by_section, &key);
+ route = hashmap_get(network->routes_by_section,
+ UINT_TO_PTR(section));
if (route) {
*ret = route;
route = NULL;
if (route) {
*ret = route;
route = NULL;
@@
-49,6
+48,7
@@
int route_new_static(Network *network, unsigned section, Route **ret) {
route->family = AF_UNSPEC;
route->scope = RT_SCOPE_UNIVERSE;
route->family = AF_UNSPEC;
route->scope = RT_SCOPE_UNIVERSE;
+ route->protocol = RTPROT_STATIC;
route->network = network;
route->network = network;
@@
-56,7
+56,8
@@
int route_new_static(Network *network, unsigned section, Route **ret) {
if (section) {
route->section = section;
if (section) {
route->section = section;
- hashmap_put(network->routes_by_section, &route->section, route);
+ hashmap_put(network->routes_by_section,
+ UINT_TO_PTR(route->section), route);
}
*ret = route;
}
*ret = route;
@@
-65,7
+66,7
@@
int route_new_static(Network *network, unsigned section, Route **ret) {
return 0;
}
return 0;
}
-int route_new_dynamic(Route **ret) {
+int route_new_dynamic(Route **ret
, unsigned char rtm_protocol
) {
_cleanup_route_free_ Route *route = NULL;
route = new0(Route, 1);
_cleanup_route_free_ Route *route = NULL;
route = new0(Route, 1);
@@
-74,6
+75,7
@@
int route_new_dynamic(Route **ret) {
route->family = AF_UNSPEC;
route->scope = RT_SCOPE_UNIVERSE;
route->family = AF_UNSPEC;
route->scope = RT_SCOPE_UNIVERSE;
+ route->protocol = rtm_protocol;
*ret = route;
route = NULL;
*ret = route;
route = NULL;
@@
-90,7
+92,7
@@
void route_free(Route *route) {
if (route->section)
hashmap_remove(route->network->routes_by_section,
if (route->section)
hashmap_remove(route->network->routes_by_section,
-
&route->section
);
+
UINT_TO_PTR(route->section)
);
}
free(route);
}
free(route);
@@
-108,7
+110,8
@@
int route_drop(Route *route, Link *link,
assert(route->family == AF_INET || route->family == AF_INET6);
r = sd_rtnl_message_new_route(link->manager->rtnl, &req,
assert(route->family == AF_INET || route->family == AF_INET6);
r = sd_rtnl_message_new_route(link->manager->rtnl, &req,
- RTM_DELROUTE, route->family);
+ RTM_DELROUTE, route->family,
+ route->protocol);
if (r < 0) {
log_error("Could not create RTM_DELROUTE message: %s", strerror(-r));
return r;
if (r < 0) {
log_error("Could not create RTM_DELROUTE message: %s", strerror(-r));
return r;
@@
-181,7
+184,8
@@
int route_configure(Route *route, Link *link,
assert(route->family == AF_INET || route->family == AF_INET6);
r = sd_rtnl_message_new_route(link->manager->rtnl, &req,
assert(route->family == AF_INET || route->family == AF_INET6);
r = sd_rtnl_message_new_route(link->manager->rtnl, &req,
- RTM_NEWROUTE, route->family);
+ RTM_NEWROUTE, route->family,
+ route->protocol);
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;