Lines Matching refs:network

79         if (address->network)  in address_free()
80 LIST_REMOVE(addresses, address->network->addresses, address); in address_free()
85 static int address_new(Network *network, int family, unsigned char prefixlen, in address_new() argument
89 assert(network); in address_new()
102 LIST_PREPEND(addresses, network->addresses, address); in address_new()
104 address->network = network; in address_new()
115 if (route->network) in route_free()
116 LIST_REMOVE(routes, route->network->routes, route); in route_free()
121 static int route_new(Network *network, int family, unsigned char prefixlen, in route_new() argument
125 assert(network); in route_new()
138 LIST_PREPEND(routes, network->routes, route); in route_new()
140 route->network = network; in route_new()
147 static Network *network_free(Network *network) { in network_free() argument
151 if (!network) in network_free()
154 free(network->ifname); in network_free()
155 free(network->hostname); in network_free()
156 strv_free(network->dns); in network_free()
157 free(network->vlan); in network_free()
158 free(network->bridge); in network_free()
159 free(network->bond); in network_free()
161 while ((address = network->addresses)) in network_free()
164 while ((route = network->routes)) in network_free()
167 return mfree(network); in network_free()
173 _cleanup_(network_freep) Network *network = NULL; in network_new()
186 network = new(Network, 1); in network_new()
187 if (!network) in network_new()
190 *network = (Network) { in network_new()
196 … r = hashmap_ensure_put(&context->networks_by_name, &string_hash_ops, network->ifname, network); in network_new()
201 *ret = network; in network_new()
203 TAKE_PTR(network); in network_new()
338 Network *network; in network_set_dhcp_type() local
346 network = network_get(context, ifname); in network_set_dhcp_type()
347 if (!network) { in network_set_dhcp_type()
348 r = network_new(context, ifname, &network); in network_set_dhcp_type()
353 network->dhcp_type = t; in network_set_dhcp_type()
358 Network *network; in network_set_hostname() local
360 network = network_get(context, ifname); in network_set_hostname()
361 if (!network) in network_set_hostname()
364 return free_and_strdup(&network->hostname, hostname); in network_set_hostname()
368 Network *network; in network_set_mtu() local
370 network = network_get(context, ifname); in network_set_mtu()
371 if (!network) in network_set_mtu()
374 return parse_mtu(family, mtu, &network->mtu); in network_set_mtu()
378 Network *network; in network_set_mac_address() local
380 network = network_get(context, ifname); in network_set_mac_address()
381 if (!network) in network_set_mac_address()
384 return parse_ether_addr(mac, &network->mac); in network_set_mac_address()
389 Network *network; in network_set_address() local
394 network = network_get(context, ifname); in network_set_address()
395 if (!network) in network_set_address()
398 return address_new(network, family, prefixlen, addr, peer, NULL); in network_set_address()
403 Network *network; in network_set_route() local
409 network = network_get(context, ifname); in network_set_route()
410 if (!network) { in network_set_route()
411 r = network_new(context, ifname, &network); in network_set_route()
416 return route_new(network, family, prefixlen, dest, gateway, NULL); in network_set_route()
421 Network *network; in network_set_dns() local
428 network = network_get(context, ifname); in network_set_dns()
429 if (!network) { in network_set_dns()
430 r = network_new(context, ifname, &network); in network_set_dns()
435 return strv_extend(&network->dns, dns); in network_set_dns()
439 Network *network; in network_set_dhcp_use_dns() local
442 network = network_get(context, ifname); in network_set_dhcp_use_dns()
443 if (!network) { in network_set_dhcp_use_dns()
444 r = network_new(context, ifname, &network); in network_set_dhcp_use_dns()
449 network->dhcp_use_dns = value; in network_set_dhcp_use_dns()
455 Network *network; in network_set_vlan() local
458 network = network_get(context, ifname); in network_set_vlan()
459 if (!network) { in network_set_vlan()
460 r = network_new(context, ifname, &network); in network_set_vlan()
465 return free_and_strdup(&network->vlan, value); in network_set_vlan()
469 Network *network; in network_set_bridge() local
472 network = network_get(context, ifname); in network_set_bridge()
473 if (!network) { in network_set_bridge()
474 r = network_new(context, ifname, &network); in network_set_bridge()
479 return free_and_strdup(&network->bridge, value); in network_set_bridge()
483 Network *network; in network_set_bond() local
486 network = network_get(context, ifname); in network_set_bond()
487 if (!network) { in network_set_bond()
488 r = network_new(context, ifname, &network); in network_set_bond()
493 return free_and_strdup(&network->bond, value); in network_set_bond()
1035 Network *all, *network; in context_merge_networks() local
1052 HASHMAP_FOREACH(network, context->networks_by_name) { in context_merge_networks()
1053 if (network == all) in context_merge_networks()
1056 network->dhcp_use_dns = all->dhcp_use_dns; in context_merge_networks()
1058 r = strv_extend_strv(&network->dns, all->dns, false); in context_merge_networks()
1063 … r = route_new(network, route->family, route->prefixlen, &route->dest, &route->gateway, NULL); in context_merge_networks()
1130 void network_dump(Network *network, FILE *f) { in network_dump() argument
1133 assert(network); in network_dump()
1139 isempty(network->ifname) ? "*" : network->ifname); in network_dump()
1143 if (!ether_addr_is_null(&network->mac)) in network_dump()
1144 fprintf(f, "MACAddress=%s\n", ETHER_ADDR_TO_STR(&network->mac)); in network_dump()
1145 if (network->mtu > 0) in network_dump()
1146 fprintf(f, "MTUBytes=%" PRIu32 "\n", network->mtu); in network_dump()
1150 dhcp = networkd_dhcp_type_to_string(network->dhcp_type); in network_dump()
1154 if (!strv_isempty(network->dns)) in network_dump()
1155 STRV_FOREACH(dns, network->dns) in network_dump()
1158 if (network->vlan) in network_dump()
1159 fprintf(f, "VLAN=%s\n", network->vlan); in network_dump()
1161 if (network->bridge) in network_dump()
1162 fprintf(f, "Bridge=%s\n", network->bridge); in network_dump()
1164 if (network->bond) in network_dump()
1165 fprintf(f, "Bond=%s\n", network->bond); in network_dump()
1169 if (!isempty(network->hostname)) in network_dump()
1170 fprintf(f, "Hostname=%s\n", network->hostname); in network_dump()
1172 if (network->dhcp_use_dns >= 0) in network_dump()
1173 fprintf(f, "UseDNS=%s\n", yes_no(network->dhcp_use_dns)); in network_dump()
1175 LIST_FOREACH(addresses, address, network->addresses) in network_dump()
1178 LIST_FOREACH(routes, route, network->routes) in network_dump()
1226 int network_format(Network *network, char **ret) { in network_format() argument
1231 assert(network); in network_format()
1241 network_dump(network, f); in network_format()