chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
networkd: refactor link_add() ...
[elogind.git]
/
src
/
network
/
networkd-network.c
diff --git
a/src/network/networkd-network.c
b/src/network/networkd-network.c
index 2a720349a07fd5395fa2c491ca52df251c69fe43..48131c1f090c1ea7af793a6c158d347771fb4aba 100644
(file)
--- a/
src/network/networkd-network.c
+++ b/
src/network/networkd-network.c
@@
-53,6
+53,10
@@
static int network_load_one(Manager *manager, const char *filename) {
LIST_HEAD_INIT(network->static_addresses);
LIST_HEAD_INIT(network->static_routes);
LIST_HEAD_INIT(network->static_addresses);
LIST_HEAD_INIT(network->static_routes);
+ network->vlans = hashmap_new(uint64_hash_func, uint64_compare_func);
+ if (!network->vlans)
+ return log_oom();
+
network->addresses_by_section = hashmap_new(uint64_hash_func, uint64_compare_func);
if (!network->addresses_by_section)
return log_oom();
network->addresses_by_section = hashmap_new(uint64_hash_func, uint64_compare_func);
if (!network->addresses_by_section)
return log_oom();
@@
-84,12
+88,6
@@
static int network_load_one(Manager *manager, const char *filename) {
"Ignoring", filename);
return 0;
}
"Ignoring", filename);
return 0;
}
-
- if (route->dst_family && route->family != route->dst_family) {
- log_warning("Route section with conflicting Gateway and Destination address "
- "family configured in %s. Ignoring", filename);
- return 0;
- }
}
LIST_FOREACH(static_addresses, address, network->static_addresses) {
}
LIST_FOREACH(static_addresses, address, network->static_addresses) {
@@
-150,6
+148,8
@@
void network_free(Network *network) {
address_free(network->dns);
address_free(network->dns);
+ hashmap_free(network->vlans);
+
while ((route = network->static_routes))
route_free(route);
while ((route = network->static_routes))
route_free(route);
@@
-223,7
+223,7
@@
int config_parse_bridge(const char *unit,
void *data,
void *userdata) {
Network *network = userdata;
void *data,
void *userdata) {
Network *network = userdata;
- Net
d
ev *netdev;
+ Net
D
ev *netdev;
int r;
assert(filename);
int r;
assert(filename);
@@
-240,7
+240,7
@@
int config_parse_bridge(const char *unit,
if (netdev->kind != NETDEV_KIND_BRIDGE) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
if (netdev->kind != NETDEV_KIND_BRIDGE) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Net
d
ev is not a bridge, ignoring assignment: %s", rvalue);
+ "Net
D
ev is not a bridge, ignoring assignment: %s", rvalue);
return 0;
}
return 0;
}
@@
-260,7
+260,7
@@
int config_parse_bond(const char *unit,
void *data,
void *userdata) {
Network *network = userdata;
void *data,
void *userdata) {
Network *network = userdata;
- Net
d
ev *netdev;
+ Net
D
ev *netdev;
int r;
assert(filename);
int r;
assert(filename);
@@
-277,7
+277,7
@@
int config_parse_bond(const char *unit,
if (netdev->kind != NETDEV_KIND_BOND) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
if (netdev->kind != NETDEV_KIND_BOND) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Net
d
ev is not a bond, ignoring assignment: %s", rvalue);
+ "Net
D
ev is not a bond, ignoring assignment: %s", rvalue);
return 0;
}
return 0;
}
@@
-297,7
+297,7
@@
int config_parse_vlan(const char *unit,
void *data,
void *userdata) {
Network *network = userdata;
void *data,
void *userdata) {
Network *network = userdata;
- Net
d
ev *netdev;
+ Net
D
ev *netdev;
int r;
assert(filename);
int r;
assert(filename);
@@
-314,11
+314,16
@@
int config_parse_vlan(const char *unit,
if (netdev->kind != NETDEV_KIND_VLAN) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
if (netdev->kind != NETDEV_KIND_VLAN) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Net
d
ev is not a VLAN, ignoring assignment: %s", rvalue);
+ "Net
D
ev is not a VLAN, ignoring assignment: %s", rvalue);
return 0;
}
return 0;
}
- network->vlan = netdev;
+ r = hashmap_put(network->vlans, &netdev->vlanid, netdev);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "Can not add VLAN to network: %s", rvalue);
+ return 0;
+ }
return 0;
}
return 0;
}