Lines Matching refs:link

14 static int link_update_ipv6_sysctl(Link *link) {  in link_update_ipv6_sysctl()  argument
15 assert(link); in link_update_ipv6_sysctl()
17 if (link->flags & IFF_LOOPBACK) in link_update_ipv6_sysctl()
20 if (!link_ipv6_enabled(link)) in link_update_ipv6_sysctl()
23 return sysctl_write_ip_property_boolean(AF_INET6, link->ifname, "disable_ipv6", false); in link_update_ipv6_sysctl()
26 static int link_set_proxy_arp(Link *link) { in link_set_proxy_arp() argument
27 assert(link); in link_set_proxy_arp()
29 if (link->flags & IFF_LOOPBACK) in link_set_proxy_arp()
32 if (!link->network) in link_set_proxy_arp()
35 if (link->network->proxy_arp < 0) in link_set_proxy_arp()
38 …return sysctl_write_ip_property_boolean(AF_INET, link->ifname, "proxy_arp", link->network->proxy_a… in link_set_proxy_arp()
41 static bool link_ip_forward_enabled(Link *link, int family) { in link_ip_forward_enabled() argument
42 assert(link); in link_ip_forward_enabled()
48 if (link->flags & IFF_LOOPBACK) in link_ip_forward_enabled()
51 if (!link->network) in link_ip_forward_enabled()
54 …return link->network->ip_forward & (family == AF_INET ? ADDRESS_FAMILY_IPV4 : ADDRESS_FAMILY_IPV6); in link_ip_forward_enabled()
57 static int link_set_ipv4_forward(Link *link) { in link_set_ipv4_forward() argument
58 assert(link); in link_set_ipv4_forward()
60 if (!link_ip_forward_enabled(link, AF_INET)) in link_set_ipv4_forward()
73 static int link_set_ipv6_forward(Link *link) { in link_set_ipv6_forward() argument
74 assert(link); in link_set_ipv6_forward()
76 if (!link_ip_forward_enabled(link, AF_INET6)) in link_set_ipv6_forward()
91 static int link_set_ipv6_privacy_extensions(Link *link) { in link_set_ipv6_privacy_extensions() argument
92 assert(link); in link_set_ipv6_privacy_extensions()
97 if (link->flags & IFF_LOOPBACK) in link_set_ipv6_privacy_extensions()
100 if (!link->network) in link_set_ipv6_privacy_extensions()
104 if (link->network->ipv6_privacy_extensions == _IPV6_PRIVACY_EXTENSIONS_INVALID) in link_set_ipv6_privacy_extensions()
107 …return sysctl_write_ip_property_int(AF_INET6, link->ifname, "use_tempaddr", (int) link->network->i… in link_set_ipv6_privacy_extensions()
110 static int link_set_ipv6_accept_ra(Link *link) { in link_set_ipv6_accept_ra() argument
111 assert(link); in link_set_ipv6_accept_ra()
117 if (link->flags & IFF_LOOPBACK) in link_set_ipv6_accept_ra()
120 if (!link->network) in link_set_ipv6_accept_ra()
123 return sysctl_write_ip_property(AF_INET6, link->ifname, "accept_ra", "0"); in link_set_ipv6_accept_ra()
126 static int link_set_ipv6_dad_transmits(Link *link) { in link_set_ipv6_dad_transmits() argument
127 assert(link); in link_set_ipv6_dad_transmits()
133 if (link->flags & IFF_LOOPBACK) in link_set_ipv6_dad_transmits()
136 if (!link->network) in link_set_ipv6_dad_transmits()
139 if (link->network->ipv6_dad_transmits < 0) in link_set_ipv6_dad_transmits()
142 …return sysctl_write_ip_property_int(AF_INET6, link->ifname, "dad_transmits", link->network->ipv6_d… in link_set_ipv6_dad_transmits()
145 static int link_set_ipv6_hop_limit(Link *link) { in link_set_ipv6_hop_limit() argument
146 assert(link); in link_set_ipv6_hop_limit()
152 if (link->flags & IFF_LOOPBACK) in link_set_ipv6_hop_limit()
155 if (!link->network) in link_set_ipv6_hop_limit()
158 if (link->network->ipv6_hop_limit < 0) in link_set_ipv6_hop_limit()
161 …return sysctl_write_ip_property_int(AF_INET6, link->ifname, "hop_limit", link->network->ipv6_hop_l… in link_set_ipv6_hop_limit()
164 static int link_set_ipv6_proxy_ndp(Link *link) { in link_set_ipv6_proxy_ndp() argument
167 assert(link); in link_set_ipv6_proxy_ndp()
172 if (link->flags & IFF_LOOPBACK) in link_set_ipv6_proxy_ndp()
175 if (!link->network) in link_set_ipv6_proxy_ndp()
178 if (link->network->ipv6_proxy_ndp >= 0) in link_set_ipv6_proxy_ndp()
179 v = link->network->ipv6_proxy_ndp; in link_set_ipv6_proxy_ndp()
181 v = !set_isempty(link->network->ipv6_proxy_ndp_addresses); in link_set_ipv6_proxy_ndp()
183 return sysctl_write_ip_property_boolean(AF_INET6, link->ifname, "proxy_ndp", v); in link_set_ipv6_proxy_ndp()
186 int link_set_ipv6_mtu(Link *link) { in link_set_ipv6_mtu() argument
189 assert(link); in link_set_ipv6_mtu()
195 if (link->flags & IFF_LOOPBACK) in link_set_ipv6_mtu()
198 if (!link->network) in link_set_ipv6_mtu()
201 if (link->network->ipv6_mtu == 0) in link_set_ipv6_mtu()
204 mtu = link->network->ipv6_mtu; in link_set_ipv6_mtu()
205 if (mtu > link->max_mtu) { in link_set_ipv6_mtu()
206 …log_link_warning(link, "Reducing requested IPv6 MTU %"PRIu32" to the interface's maximum MTU %"PRI… in link_set_ipv6_mtu()
207 mtu, link->max_mtu); in link_set_ipv6_mtu()
208 mtu = link->max_mtu; in link_set_ipv6_mtu()
211 return sysctl_write_ip_property_uint32(AF_INET6, link->ifname, "mtu", mtu); in link_set_ipv6_mtu()
214 static int link_set_ipv4_accept_local(Link *link) { in link_set_ipv4_accept_local() argument
215 assert(link); in link_set_ipv4_accept_local()
217 if (link->flags & IFF_LOOPBACK) in link_set_ipv4_accept_local()
220 if (link->network->ipv4_accept_local < 0) in link_set_ipv4_accept_local()
223 …return sysctl_write_ip_property_boolean(AF_INET, link->ifname, "accept_local", link->network->ipv4… in link_set_ipv4_accept_local()
226 static int link_set_ipv4_route_localnet(Link *link) { in link_set_ipv4_route_localnet() argument
227 assert(link); in link_set_ipv4_route_localnet()
229 if (link->flags & IFF_LOOPBACK) in link_set_ipv4_route_localnet()
232 if (link->network->ipv4_route_localnet < 0) in link_set_ipv4_route_localnet()
235 …return sysctl_write_ip_property_boolean(AF_INET, link->ifname, "route_localnet", link->network->ip… in link_set_ipv4_route_localnet()
238 int link_set_sysctl(Link *link) { in link_set_sysctl() argument
241 assert(link); in link_set_sysctl()
245 r = link_update_ipv6_sysctl(link); in link_set_sysctl()
247 log_link_warning_errno(link, r, "Cannot enable IPv6, ignoring: %m"); in link_set_sysctl()
249 r = link_set_proxy_arp(link); in link_set_sysctl()
251 … log_link_warning_errno(link, r, "Cannot configure proxy ARP for interface, ignoring: %m"); in link_set_sysctl()
253 r = link_set_ipv4_forward(link); in link_set_sysctl()
255 … log_link_warning_errno(link, r, "Cannot turn on IPv4 packet forwarding, ignoring: %m"); in link_set_sysctl()
257 r = link_set_ipv6_forward(link); in link_set_sysctl()
259 … log_link_warning_errno(link, r, "Cannot configure IPv6 packet forwarding, ignoring: %m");; in link_set_sysctl()
261 r = link_set_ipv6_privacy_extensions(link); in link_set_sysctl()
263 …log_link_warning_errno(link, r, "Cannot configure IPv6 privacy extensions for interface, ignoring:… in link_set_sysctl()
265 r = link_set_ipv6_accept_ra(link); in link_set_sysctl()
267 …log_link_warning_errno(link, r, "Cannot disable kernel IPv6 accept_ra for interface, ignoring: %m"… in link_set_sysctl()
269 r = link_set_ipv6_dad_transmits(link); in link_set_sysctl()
271 … log_link_warning_errno(link, r, "Cannot set IPv6 dad transmits for interface, ignoring: %m"); in link_set_sysctl()
273 r = link_set_ipv6_hop_limit(link); in link_set_sysctl()
275 … log_link_warning_errno(link, r, "Cannot set IPv6 hop limit for interface, ignoring: %m"); in link_set_sysctl()
277 r = link_set_ipv6_proxy_ndp(link); in link_set_sysctl()
279 log_link_warning_errno(link, r, "Cannot set IPv6 proxy NDP, ignoring: %m"); in link_set_sysctl()
281 r = link_set_ipv6_mtu(link); in link_set_sysctl()
283 log_link_warning_errno(link, r, "Cannot set IPv6 MTU, ignoring: %m"); in link_set_sysctl()
285 r = link_set_ipv6ll_stable_secret(link); in link_set_sysctl()
287 …log_link_warning_errno(link, r, "Cannot set stable secret address for IPv6 link-local address: %m"… in link_set_sysctl()
289 r = link_set_ipv4_accept_local(link); in link_set_sysctl()
291 … log_link_warning_errno(link, r, "Cannot set IPv4 accept_local flag for interface, ignoring: %m"); in link_set_sysctl()
293 r = link_set_ipv4_route_localnet(link); in link_set_sysctl()
295 …log_link_warning_errno(link, r, "Cannot set IPv4 route_localnet flag for interface, ignoring: %m"); in link_set_sysctl()
302 r = sysctl_write_ip_property_boolean(AF_INET, link->ifname, "promote_secondaries", true); in link_set_sysctl()
304 … log_link_warning_errno(link, r, "Cannot enable promote_secondaries for interface, ignoring: %m"); in link_set_sysctl()