Home
last modified time | relevance | path

Searched refs:netdev (Results 1 – 25 of 47) sorted by relevance

12

/systemd-251/src/network/netdev/
Dnetdev.c137 bool netdev_is_managed(NetDev *netdev) { in netdev_is_managed() argument
138 if (!netdev || !netdev->manager || !netdev->ifname) in netdev_is_managed()
141 return hashmap_get(netdev->manager->netdevs, netdev->ifname) == netdev; in netdev_is_managed()
144 static bool netdev_is_stacked_and_independent(NetDev *netdev) { in netdev_is_stacked_and_independent() argument
145 assert(netdev); in netdev_is_stacked_and_independent()
147 if (netdev_get_create_type(netdev) != NETDEV_CREATE_STACKED) in netdev_is_stacked_and_independent()
150 switch (netdev->kind) { in netdev_is_stacked_and_independent()
152 return ERSPAN(netdev)->independent; in netdev_is_stacked_and_independent()
154 return GRE(netdev)->independent; in netdev_is_stacked_and_independent()
156 return GRETAP(netdev)->independent; in netdev_is_stacked_and_independent()
[all …]
Dnetdev.h150 int (*fill_message_create)(NetDev *netdev, Link *link, sd_netlink_message *message);
156 int (*is_ready_to_create)(NetDev *netdev, Link *link);
159 int (*create)(NetDev *netdev);
162 int (*post_create)(NetDev *netdev, Link *link);
165 int (*config_verify)(NetDev *netdev, const char *filename);
197 void netdev_drop(NetDev *netdev);
198 void netdev_enter_failed(NetDev *netdev);
200 NetDev *netdev_unref(NetDev *netdev);
201 NetDev *netdev_ref(NetDev *netdev);
205 bool netdev_is_managed(NetDev *netdev);
[all …]
Dwlan.c14 static void wlan_done(NetDev *netdev) { in wlan_done() argument
17 assert(netdev); in wlan_done()
19 w = WLAN(netdev); in wlan_done()
26 static void wlan_init(NetDev *netdev) { in wlan_init() argument
29 assert(netdev); in wlan_init()
31 w = WLAN(netdev); in wlan_init()
39 static int wlan_get_wiphy(NetDev *netdev, Wiphy **ret) { in wlan_get_wiphy() argument
42 assert(netdev); in wlan_get_wiphy()
44 w = WLAN(netdev); in wlan_get_wiphy()
49 return wiphy_get_by_name(netdev->manager, w->wiphy_name, ret); in wlan_get_wiphy()
[all …]
Dtuntap.c19 static int netdev_fill_tuntap_message(NetDev *netdev, struct ifreq *ifr) { in netdev_fill_tuntap_message() argument
22 assert(netdev); in netdev_fill_tuntap_message()
23 assert(netdev->ifname); in netdev_fill_tuntap_message()
26 if (netdev->kind == NETDEV_KIND_TAP) { in netdev_fill_tuntap_message()
27 t = TAP(netdev); in netdev_fill_tuntap_message()
30 t = TUN(netdev); in netdev_fill_tuntap_message()
43 strncpy(ifr->ifr_name, netdev->ifname, IFNAMSIZ-1); in netdev_fill_tuntap_message()
48 static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) { in netdev_tuntap_add() argument
57 assert(netdev); in netdev_tuntap_add()
62 return log_netdev_error_errno(netdev, errno, "Failed to open tun dev: %m"); in netdev_tuntap_add()
[all …]
Dmacsec.c221 static int netdev_macsec_create_message(NetDev *netdev, int command, sd_netlink_message **ret) { in netdev_macsec_create_message() argument
225 assert(netdev); in netdev_macsec_create_message()
226 assert(netdev->ifindex > 0); in netdev_macsec_create_message()
228 r = sd_genl_message_new(netdev->manager->genl, MACSEC_GENL_NAME, command, &m); in netdev_macsec_create_message()
232 r = sd_netlink_message_append_u32(m, MACSEC_ATTR_IFINDEX, netdev->ifindex); in netdev_macsec_create_message()
241 static int netdev_macsec_fill_message_sci(NetDev *netdev, MACsecSCI *sci, sd_netlink_message *m) { in netdev_macsec_fill_message_sci() argument
244 assert(netdev); in netdev_macsec_fill_message_sci()
263 static int netdev_macsec_fill_message_sa(NetDev *netdev, SecurityAssociation *a, sd_netlink_message… in netdev_macsec_fill_message_sa() argument
266 assert(netdev); in netdev_macsec_fill_message_sa()
307 …c int macsec_receive_association_handler(sd_netlink *rtnl, sd_netlink_message *m, NetDev *netdev) { in macsec_receive_association_handler() argument
[all …]
Dfou-tunnel.c27 static int netdev_fill_fou_tunnel_message(NetDev *netdev, sd_netlink_message *m) { in netdev_fill_fou_tunnel_message() argument
32 assert_se(t = FOU(netdev)); in netdev_fill_fou_tunnel_message()
90 static int netdev_create_fou_tunnel_message(NetDev *netdev, sd_netlink_message **ret) { in netdev_create_fou_tunnel_message() argument
94 assert(netdev); in netdev_create_fou_tunnel_message()
96 r = sd_genl_message_new(netdev->manager->genl, FOU_GENL_NAME, FOU_CMD_ADD, &m); in netdev_create_fou_tunnel_message()
98 return log_netdev_error_errno(netdev, r, "Could not allocate netlink message: %m"); in netdev_create_fou_tunnel_message()
100 r = netdev_fill_fou_tunnel_message(netdev, m); in netdev_create_fou_tunnel_message()
102 return log_netdev_error_errno(netdev, r, "Could not create netlink message: %m"); in netdev_create_fou_tunnel_message()
108 static int fou_tunnel_create_handler(sd_netlink *rtnl, sd_netlink_message *m, NetDev *netdev) { in fou_tunnel_create_handler() argument
111 assert(netdev); in fou_tunnel_create_handler()
[all …]
Dl2tp-tunnel.c95 static int netdev_l2tp_create_message_tunnel(NetDev *netdev, union in_addr_union *local_address, sd… in netdev_l2tp_create_message_tunnel() argument
101 assert(netdev); in netdev_l2tp_create_message_tunnel()
103 assert_se(t = L2TP(netdev)); in netdev_l2tp_create_message_tunnel()
105 r = sd_genl_message_new(netdev->manager->genl, L2TP_GENL_NAME, L2TP_CMD_TUNNEL_CREATE, &m); in netdev_l2tp_create_message_tunnel()
186 static int netdev_l2tp_create_message_session(NetDev *netdev, L2tpSession *session, sd_netlink_mess… in netdev_l2tp_create_message_session() argument
192 assert(netdev); in netdev_l2tp_create_message_session()
196 r = sd_genl_message_new(netdev->manager->genl, L2TP_GENL_NAME, L2TP_CMD_SESSION_CREATE, &m); in netdev_l2tp_create_message_session()
280 static int l2tp_get_local_address(NetDev *netdev, union in_addr_union *ret) { in l2tp_get_local_address() argument
286 assert(netdev); in l2tp_get_local_address()
287 assert(netdev->manager); in l2tp_get_local_address()
[all …]
Dwireguard.c34 static void wireguard_resolve_endpoints(NetDev *netdev);
110 static int wireguard_set_ipmask_one(NetDev *netdev, sd_netlink_message *message, const WireguardIPm… in wireguard_set_ipmask_one() argument
137 return log_netdev_error_errno(netdev, r, "Could not add wireguard allowed ip: %m"); in wireguard_set_ipmask_one()
144 …return log_netdev_error_errno(netdev, r, "Could not cancel wireguard allowed ip message attribute:… in wireguard_set_ipmask_one()
149 static int wireguard_set_peer_one(NetDev *netdev, sd_netlink_message *message, const WireguardPeer … in wireguard_set_peer_one() argument
196 r = wireguard_set_ipmask_one(netdev, message, mask, ++j); in wireguard_set_peer_one()
207 return log_netdev_error_errno(netdev, r, "Could not add wireguard allowed ip: %m"); in wireguard_set_peer_one()
211 return log_netdev_error_errno(netdev, r, "Could not add wireguard peer: %m"); in wireguard_set_peer_one()
219 return log_netdev_error_errno(netdev, r, "Could not cancel wireguard peers: %m"); in wireguard_set_peer_one()
224 static int wireguard_set_interface(NetDev *netdev) { in wireguard_set_interface() argument
[all …]
Dbatadv.c100 static int netdev_batman_set_handler(sd_netlink *rtnl, sd_netlink_message *m, NetDev *netdev) { in netdev_batman_set_handler() argument
103 assert(netdev); in netdev_batman_set_handler()
108 log_netdev_warning_errno(netdev, r, "BATADV parameters could not be set: %m"); in netdev_batman_set_handler()
112 log_netdev_debug(netdev, "BATADV parameters set success"); in netdev_batman_set_handler()
117 static int netdev_batadv_post_create_message(NetDev *netdev, sd_netlink_message *message) { in netdev_batadv_post_create_message() argument
121 assert_se(b = BATADV(netdev)); in netdev_batadv_post_create_message()
123 r = sd_netlink_message_append_u32(message, BATADV_ATTR_MESH_IFINDEX, netdev->ifindex); in netdev_batadv_post_create_message()
166 static int netdev_batadv_post_create(NetDev *netdev, Link *link) { in netdev_batadv_post_create() argument
170 assert(netdev); in netdev_batadv_post_create()
172 … r = sd_genl_message_new(netdev->manager->genl, BATADV_NL_NAME, BATADV_CMD_SET_MESH, &message); in netdev_batadv_post_create()
[all …]
Dtunnel.c202 static int netdev_ipip_sit_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) { in netdev_ipip_sit_fill_message_create() argument
207 assert(netdev); in netdev_ipip_sit_fill_message_create()
210 if (netdev->kind == NETDEV_KIND_IPIP) in netdev_ipip_sit_fill_message_create()
211 t = IPIP(netdev); in netdev_ipip_sit_fill_message_create()
213 t = SIT(netdev); in netdev_ipip_sit_fill_message_create()
234 return log_netdev_error_errno(netdev, r, "Could not find local address: %m"); in netdev_ipip_sit_fill_message_create()
266 if (netdev->kind == NETDEV_KIND_SIT) { in netdev_ipip_sit_fill_message_create()
294 static int netdev_gre_erspan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m)… in netdev_gre_erspan_fill_message_create() argument
303 assert(netdev); in netdev_gre_erspan_fill_message_create()
306 switch (netdev->kind) { in netdev_gre_erspan_fill_message_create()
[all …]
Dtunnel.h81 static inline Tunnel* TUNNEL(NetDev *netdev) { in TUNNEL() argument
82 assert(netdev); in TUNNEL()
84 switch (netdev->kind) { in TUNNEL()
86 return IPIP(netdev); in TUNNEL()
88 return SIT(netdev); in TUNNEL()
90 return GRE(netdev); in TUNNEL()
92 return GRETAP(netdev); in TUNNEL()
94 return IP6GRE(netdev); in TUNNEL()
96 return IP6GRETAP(netdev); in TUNNEL()
98 return VTI(netdev); in TUNNEL()
[all …]
Dbridge.c31 static int netdev_bridge_set_handler(sd_netlink *rtnl, sd_netlink_message *m, NetDev *netdev) { in netdev_bridge_set_handler() argument
34 assert(netdev); in netdev_bridge_set_handler()
39 log_netdev_warning_errno(netdev, r, "Bridge parameters could not be set: %m"); in netdev_bridge_set_handler()
43 log_netdev_debug(netdev, "Bridge parameters set success"); in netdev_bridge_set_handler()
48 static int netdev_bridge_post_create_message(NetDev *netdev, sd_netlink_message *req) { in netdev_bridge_post_create_message() argument
52 assert_se(b = BRIDGE(netdev)); in netdev_bridge_post_create_message()
58 … sd_netlink_message_open_container_union(req, IFLA_INFO_DATA, netdev_kind_to_string(netdev->kind)); in netdev_bridge_post_create_message()
152 static int netdev_bridge_post_create(NetDev *netdev, Link *link) { in netdev_bridge_post_create() argument
156 assert(netdev); in netdev_bridge_post_create()
158 r = sd_rtnl_message_new_link(netdev->manager->rtnl, &req, RTM_NEWLINK, netdev->ifindex); in netdev_bridge_post_create()
[all …]
Dbareudp.c23 static int netdev_bare_udp_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) { in netdev_bare_udp_fill_message_create() argument
27 assert(netdev); in netdev_bare_udp_fill_message_create()
30 u = BAREUDP(netdev); in netdev_bare_udp_fill_message_create()
45 static int netdev_bare_udp_verify(NetDev *netdev, const char *filename) { in netdev_bare_udp_verify() argument
48 assert(netdev); in netdev_bare_udp_verify()
51 u = BAREUDP(netdev); in netdev_bare_udp_verify()
56 return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL), in netdev_bare_udp_verify()
60 return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL), in netdev_bare_udp_verify()
66 static void bare_udp_init(NetDev *netdev) { in bare_udp_init() argument
69 assert(netdev); in bare_udp_init()
[all …]
Dveth.c12 static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) { in netdev_veth_fill_message_create() argument
17 assert(netdev); in netdev_veth_fill_message_create()
21 v = VETH(netdev); in netdev_veth_fill_message_create()
35 r = netdev_generate_hw_addr(netdev, NULL, v->ifname_peer, &v->hw_addr_peer, &hw_addr); in netdev_veth_fill_message_create()
40 … log_netdev_debug(netdev, "Using MAC address for peer: %s", HW_ADDR_TO_STR(&hw_addr)); in netdev_veth_fill_message_create()
46 if (netdev->mtu != 0) { in netdev_veth_fill_message_create()
47 r = sd_netlink_message_append_u32(m, IFLA_MTU, netdev->mtu); in netdev_veth_fill_message_create()
59 static int netdev_veth_verify(NetDev *netdev, const char *filename) { in netdev_veth_verify() argument
62 assert(netdev); in netdev_veth_verify()
65 v = VETH(netdev); in netdev_veth_verify()
[all …]
Dxfrm.c8 static int xfrm_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *message) { in xfrm_fill_message_create() argument
12 assert(netdev); in xfrm_fill_message_create()
15 x = XFRM(netdev); in xfrm_fill_message_create()
31 static int xfrm_verify(NetDev *netdev, const char *filename) { in xfrm_verify() argument
34 assert(netdev); in xfrm_verify()
37 x = XFRM(netdev); in xfrm_verify()
42 return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL), in xfrm_verify()
Dvxcan.c8 static int netdev_vxcan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) { in netdev_vxcan_fill_message_create() argument
12 assert(netdev); in netdev_vxcan_fill_message_create()
16 v = VXCAN(netdev); in netdev_vxcan_fill_message_create()
37 static int netdev_vxcan_verify(NetDev *netdev, const char *filename) { in netdev_vxcan_verify() argument
40 assert(netdev); in netdev_vxcan_verify()
43 v = VXCAN(netdev); in netdev_vxcan_verify()
48 return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL), in netdev_vxcan_verify()
Dvxlan.c39 static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) { in netdev_vxlan_fill_message_create() argument
44 assert(netdev); in netdev_vxlan_fill_message_create()
47 v = VXLAN(netdev); in netdev_vxlan_fill_message_create()
393 static int netdev_vxlan_verify(NetDev *netdev, const char *filename) { in netdev_vxlan_verify() argument
394 VxLan *v = VXLAN(netdev); in netdev_vxlan_verify()
396 assert(netdev); in netdev_vxlan_verify()
401 return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL), in netdev_vxlan_verify()
406 return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL), in netdev_vxlan_verify()
414 return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL), in netdev_vxlan_verify()
419 return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL), in netdev_vxlan_verify()
[all …]
Dipvlan.c16 static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) { in netdev_ipvlan_fill_message_create() argument
20 assert(netdev); in netdev_ipvlan_fill_message_create()
22 assert(netdev->ifname); in netdev_ipvlan_fill_message_create()
24 if (netdev->kind == NETDEV_KIND_IPVLAN) in netdev_ipvlan_fill_message_create()
25 m = IPVLAN(netdev); in netdev_ipvlan_fill_message_create()
27 m = IPVTAP(netdev); in netdev_ipvlan_fill_message_create()
87 ipvlan = IPVLAN(link->netdev); in link_get_ipvlan_mode()
Dvlan.c12 static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) { in netdev_vlan_fill_message_create() argument
17 assert(netdev); in netdev_vlan_fill_message_create()
21 v = VLAN(netdev); in netdev_vlan_fill_message_create()
182 static int netdev_vlan_verify(NetDev *netdev, const char *filename) { in netdev_vlan_verify() argument
185 assert(netdev); in netdev_vlan_verify()
188 v = VLAN(netdev); in netdev_vlan_verify()
193 …log_netdev_warning(netdev, "VLAN without valid Id (%"PRIu16") configured in %s.", v->id, filename); in netdev_vlan_verify()
211 static void vlan_init(NetDev *netdev) { in vlan_init() argument
212 VLan *v = VLAN(netdev); in vlan_init()
214 assert(netdev); in vlan_init()
Dgeneve.c30 static int netdev_geneve_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) { in netdev_geneve_fill_message_create() argument
34 assert(netdev); in netdev_geneve_fill_message_create()
37 v = GENEVE(netdev); in netdev_geneve_fill_message_create()
258 static int netdev_geneve_verify(NetDev *netdev, const char *filename) { in netdev_geneve_verify() argument
259 Geneve *v = GENEVE(netdev); in netdev_geneve_verify()
261 assert(netdev); in netdev_geneve_verify()
266 return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL), in netdev_geneve_verify()
273 static void geneve_init(NetDev *netdev) { in geneve_init() argument
276 assert(netdev); in geneve_init()
278 v = GENEVE(netdev); in geneve_init()
Dnlmon.c7 static int netdev_nlmon_verify(NetDev *netdev, const char *filename) { in netdev_nlmon_verify() argument
8 assert(netdev); in netdev_nlmon_verify()
11 if (netdev->hw_addr.length > 0) { in netdev_nlmon_verify()
12 log_netdev_warning(netdev, "%s: MACAddress= is not supported. Ignoring", filename); in netdev_nlmon_verify()
13 netdev->hw_addr = HW_ADDR_NULL; in netdev_nlmon_verify()
Dipoib.c14 static void netdev_ipoib_init(NetDev *netdev) { in netdev_ipoib_init() argument
17 assert(netdev); in netdev_ipoib_init()
19 ipoib = IPOIB(netdev); in netdev_ipoib_init()
27 static int netdev_ipoib_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) { in netdev_ipoib_fill_message_create() argument
31 assert(netdev); in netdev_ipoib_fill_message_create()
35 ipoib = IPOIB(netdev); in netdev_ipoib_fill_message_create()
/systemd-251/src/network/
Dmeson.build4 'netdev/bareudp.c',
5 'netdev/bareudp.h',
6 'netdev/batadv.c',
7 'netdev/batadv.h',
8 'netdev/bond.c',
9 'netdev/bond.h',
10 'netdev/bridge.c',
11 'netdev/bridge.h',
12 'netdev/dummy.c',
13 'netdev/dummy.h',
[all …]
/systemd-251/src/network/generator/
Dnetwork-generator.c211 static NetDev *netdev_free(NetDev *netdev) { in netdev_free() argument
212 if (!netdev) in netdev_free()
215 free(netdev->ifname); in netdev_free()
216 free(netdev->kind); in netdev_free()
217 return mfree(netdev); in netdev_free()
223 _cleanup_(netdev_freep) NetDev *netdev = NULL; in netdev_new()
240 netdev = new(NetDev, 1); in netdev_new()
241 if (!netdev) in netdev_new()
244 *netdev = (NetDev) { in netdev_new()
249 r = hashmap_ensure_put(&context->netdevs_by_name, &string_hash_ops, netdev->ifname, netdev); in netdev_new()
[all …]
Dmain.c40 static int netdev_save(NetDev *netdev, const char *dest_dir) { in netdev_save() argument
45 assert(netdev); in netdev_save()
48 netdev->ifname); in netdev_save()
56 netdev_dump(netdev, f); in netdev_save()
85 NetDev *netdev; in context_save() local
102 HASHMAP_FOREACH(netdev, context->netdevs_by_name) { in context_save()
103 k = netdev_save(netdev, p); in context_save()

12