Home
last modified time | relevance | path

Searched refs:prefixlen (Results 1 – 25 of 66) sorted by relevance

123

/systemd-251/src/basic/
Din-addr-util.c227 int in_addr_prefix_next(int family, union in_addr_union *u, unsigned prefixlen) { in in_addr_prefix_next() argument
233 return in_addr_prefix_nth(family, u, prefixlen, 1); in in_addr_prefix_next()
251 int in_addr_prefix_nth(int family, union in_addr_union *u, unsigned prefixlen, uint64_t nth) { in in_addr_prefix_nth() argument
254 if (prefixlen <= 0) in in_addr_prefix_nth()
260 if (prefixlen > 32) in in_addr_prefix_nth()
265 t = nth << (32 - prefixlen); in in_addr_prefix_nth()
273 n &= UINT32_C(0xFFFFFFFF) << (32 - prefixlen); in in_addr_prefix_nth()
281 if (prefixlen > 128) in in_addr_prefix_nth()
287 if (p >= prefixlen) { in in_addr_prefix_nth()
292 if (prefixlen - p < 8) { in in_addr_prefix_nth()
[all …]
Din-addr-util.h62 int in_addr_prefix_next(int family, union in_addr_union *u, unsigned prefixlen);
63 int in_addr_prefix_nth(int family, union in_addr_union *u, unsigned prefixlen, uint64_t nth);
64 …ndom_prefix(int family, union in_addr_union *u, unsigned prefixlen_fixed_part, unsigned prefixlen);
68 unsigned prefixlen,
75 int in_addr_prefix_to_string(int family, const union in_addr_union *u, unsigned prefixlen, char **r…
76 static inline int in6_addr_prefix_to_string(const struct in6_addr *u, unsigned prefixlen, char **re… in in6_addr_prefix_to_string() argument
77 return in_addr_prefix_to_string(AF_INET6, (const union in_addr_union*) u, prefixlen, ret); in in6_addr_prefix_to_string()
90 struct in_addr* in4_addr_prefixlen_to_netmask(struct in_addr *addr, unsigned char prefixlen);
91 int in4_addr_default_prefixlen(const struct in_addr *addr, unsigned char *prefixlen);
93 int in4_addr_mask(struct in_addr *addr, unsigned char prefixlen);
[all …]
/systemd-251/src/network/
Dnetworkd-address-pool.c16 unsigned prefixlen) { in address_pool_new() argument
31 .prefixlen = prefixlen, in address_pool_new()
47 unsigned prefixlen) { in address_pool_new_from_string() argument
59 return address_pool_new(m, family, &u, prefixlen); in address_pool_new_from_string()
90 unsigned prefixlen) { in address_pool_prefix_is_taken() argument
106 … if (in_addr_prefix_intersect(p->family, u, prefixlen, &a->in_addr, a->prefixlen)) in address_pool_prefix_is_taken()
119 … if (in_addr_prefix_intersect(p->family, u, prefixlen, &a->in_addr, a->prefixlen)) in address_pool_prefix_is_taken()
127 static int address_pool_acquire_one(AddressPool *p, int family, unsigned prefixlen, union in_addr_u… in address_pool_acquire_one() argument
132 assert(prefixlen > 0); in address_pool_acquire_one()
138 if (p->prefixlen >= prefixlen) in address_pool_acquire_one()
[all …]
Dnetworkd-address.c190 if (a->prefixlen > 30) in address_needs_to_set_broadcast()
212 a->broadcast.s_addr = a->in_addr.in.s_addr | htobe32(UINT32_C(0xffffffff) >> a->prefixlen); in address_set_broadcast()
255 if (a->prefixlen == 0) in address_prefix()
259 return be32toh(a->in_addr_peer.in.s_addr) >> (32 - a->prefixlen); in address_prefix()
261 return be32toh(a->in_addr.in.s_addr) >> (32 - a->prefixlen); in address_prefix()
271 siphash24_compress(&a->prefixlen, sizeof(a->prefixlen), state); in address_kernel_hash_func()
296 r = CMP(a1->prefixlen, a2->prefixlen); in address_kernel_compare_func()
329 siphash24_compress(&a->prefixlen, sizeof(a->prefixlen), state); in address_hash_func()
353 r = CMP(a1->prefixlen, a2->prefixlen); in address_compare_func()
438 r = in_addr_mask(address->family, &masked, address->prefixlen); in address_set_masquerade()
[all …]
Dnetworkd-address.h37 unsigned char prefixlen; member
91 …ink *link, int family, const union in_addr_union *address, unsigned char prefixlen, Address **ret);
92 …_ipv6_address(Link *link, const struct in6_addr *address, unsigned char prefixlen, Address **ret) { in link_get_ipv6_address() argument
94 …eturn link_get_address(link, AF_INET6, &(union in_addr_union) { .in6 = *address }, prefixlen, ret); in link_get_ipv6_address()
96 …t_ipv4_address(Link *link, const struct in_addr *address, unsigned char prefixlen, Address **ret) { in link_get_ipv4_address() argument
98 … return link_get_address(link, AF_INET, &(union in_addr_union) { .in = *address }, prefixlen, ret); in link_get_ipv4_address()
100 … *manager, int family, const union in_addr_union *address, unsigned char prefixlen, Address **ret);
Dnetworkd-ndisc.c403 unsigned prefixlen; in ndisc_router_process_autonomous_prefix() local
421 r = sd_ndisc_router_prefix_get_prefixlen(rt, &prefixlen); in ndisc_router_process_autonomous_prefix()
426 if (prefixlen > 64) { in ndisc_router_process_autonomous_prefix()
429 (void) in6_addr_prefix_to_string(&prefix, prefixlen, &buf); in ndisc_router_process_autonomous_prefix()
454 r = ndisc_generate_addresses(link, &prefix, prefixlen, &addresses); in ndisc_router_process_autonomous_prefix()
468 address->prefixlen = prefixlen; in ndisc_router_process_autonomous_prefix()
496 unsigned prefixlen; in ndisc_router_process_onlink_prefix() local
517 r = sd_ndisc_router_prefix_get_prefixlen(rt, &prefixlen); in ndisc_router_process_onlink_prefix()
527 route->dst_prefixlen = prefixlen; in ndisc_router_process_onlink_prefix()
542 unsigned prefixlen; in ndisc_router_process_prefix() local
[all …]
Dnetworkd-dhcp-prefix-delegation.c372 (void) in6_addr_prefix_to_string(&address->in_addr.in6, address->prefixlen, &buffer); in log_dhcp_pd_address()
412 address->prefixlen = 64; in dhcp_pd_request_address()
633 .prefixlen = route->dst_prefixlen, in dhcp_pd_prefix_lost()
690 uint8_t prefixlen, in dhcp_request_unreachable_route() argument
708 if (prefixlen >= 64) { in dhcp_request_unreachable_route()
711 (void) in6_addr_prefix_to_string(addr, prefixlen, &buf); in dhcp_request_unreachable_route()
725 route->dst_prefixlen = prefixlen; in dhcp_request_unreachable_route()
740 (void) in6_addr_prefix_to_string(addr, prefixlen, &buf); in dhcp_request_unreachable_route()
751 uint8_t prefixlen, in dhcp4_request_unreachable_route() argument
755 return dhcp_request_unreachable_route(link, addr, prefixlen, lifetime_usec, in dhcp4_request_unreachable_route()
[all …]
Dnetworkd-address-label.c112 r = sd_rtnl_message_addrlabel_set_prefixlen(m, label->prefixlen); in address_label_configure()
220 unsigned char prefixlen; in config_parse_address_label_prefix() local
234 r = in_addr_prefix_from_string(rvalue, AF_INET6, &a, &prefixlen); in config_parse_address_label_prefix()
240 if (in6_addr_is_ipv4_mapped_address(&a.in6) && prefixlen > 96) { in config_parse_address_label_prefix()
249 n->prefixlen = prefixlen; in config_parse_address_label_prefix()
Dnetworkd-radv.c197 if (p->prefixlen > 64) in link_request_radv_addresses()
200 r = radv_generate_addresses(link, p->tokens, &p->prefix, p->prefixlen, &addresses); in link_request_radv_addresses()
214 address->prefixlen = p->prefixlen; in link_request_radv_addresses()
251 r = sd_radv_prefix_set_prefix(p, &prefix->prefix, prefix->prefixlen); in radv_set_prefix()
286 r = sd_radv_route_prefix_set_prefix(p, &prefix->prefix, prefix->prefixlen); in radv_set_route_prefix()
707 if (p->prefixlen < 3 || p->prefixlen > 128) in prefix_section_verify()
711 p->section->filename, p->prefixlen, p->section->line); in prefix_section_verify()
713 if (p->prefixlen > 64) { in prefix_section_verify()
717 (void) in6_addr_prefix_to_string(&p->prefix, p->prefixlen, &str); in prefix_section_verify()
720 p->section->filename, p->prefixlen, p->section->line, in prefix_section_verify()
[all …]
Dnetworkd-address-generation.c178 uint8_t prefixlen, in generate_addresses() argument
189 assert(prefixlen > 0 && prefixlen <= 64); in generate_addresses()
193 in6_addr_mask(&masked, prefixlen); in generate_addresses()
259 int ndisc_generate_addresses(Link *link, const struct in6_addr *prefix, uint8_t prefixlen, Set **re… in ndisc_generate_addresses() argument
260 …eturn generate_addresses(link, link->network->ndisc_tokens, &NDISC_APP_ID, prefix, prefixlen, ret); in ndisc_generate_addresses()
263 …e_addresses(Link *link, Set *tokens, const struct in6_addr *prefix, uint8_t prefixlen, Set **ret) { in radv_generate_addresses() argument
264 return generate_addresses(link, tokens, &RADV_APP_ID, prefix, prefixlen, ret); in radv_generate_addresses()
Dnetworkd-dhcp6.c175 if (address->prefixlen == existing->prefixlen) in verify_dhcp6_address()
183 strna(buffer), address->prefixlen, in verify_dhcp6_address()
186 strna(buffer), existing->prefixlen, in verify_dhcp6_address()
195 strna(buffer), address->prefixlen, in verify_dhcp6_address()
221 addr->prefixlen = 128; in dhcp6_request_address()
826 unsigned char prefixlen; in config_parse_dhcp6_pd_prefix_hint() local
834 r = in_addr_prefix_from_string(rvalue, AF_INET6, &u, &prefixlen); in config_parse_dhcp6_pd_prefix_hint()
841 if (prefixlen < 1 || prefixlen > 128) { in config_parse_dhcp6_pd_prefix_hint()
848 network->dhcp6_pd_prefix_length = prefixlen; in config_parse_dhcp6_pd_prefix_hint()
Dnetworkd-dhcp-common.h77 bool address_is_filtered(int family, const union in_addr_union *address, uint8_t prefixlen, Set *al…
81 static inline bool in6_prefix_is_filtered(const struct in6_addr *prefix, uint8_t prefixlen, Set *al… in in6_prefix_is_filtered() argument
82 …return address_is_filtered(AF_INET6, &(union in_addr_union) { .in6 = *prefix }, prefixlen, allow_l… in in6_prefix_is_filtered()
Dnetworkd-address-pool.h12 unsigned prefixlen; member
17 int address_pool_acquire(Manager *m, int family, unsigned prefixlen, union in_addr_union *found);
Dnetworkd-dhcp4.c324 uint8_t prefixlen; in dhcp4_request_route_auto() local
341 prefixlen = in4_addr_netmask_to_prefixlen(&netmask); in dhcp4_request_route_auto()
365 } else if (route->dst_prefixlen >= prefixlen && in dhcp4_request_route_auto()
371 IPV4_ADDRESS_FMT_VAL(prefix), prefixlen, in dhcp4_request_route_auto()
384 IPV4_ADDRESS_FMT_VAL(prefix), prefixlen); in dhcp4_request_route_auto()
445 uint8_t prefixlen; in dhcp4_request_static_routes() local
454 … r = sd_dhcp_route_get_destination_prefix_length(classless_routes[i], &prefixlen); in dhcp4_request_static_routes()
458 if (prefixlen != 0) in dhcp4_request_static_routes()
836 unsigned prefixlen; in dhcp4_request_address() local
868 prefixlen = in4_addr_netmask_to_prefixlen(&netmask); in dhcp4_request_address()
[all …]
Dnetworkd-address-generation.h11 int ndisc_generate_addresses(Link *link, const struct in6_addr *prefix, uint8_t prefixlen, Set **re…
12 …te_addresses(Link *link, Set *tokens, const struct in6_addr *prefix, uint8_t prefixlen, Set **ret);
/systemd-251/src/shared/
Din-addr-prefix-util.c18 .prefixlen = 8, \
25 .prefixlen = 128, \
33 .prefixlen = 16, \
41 .prefixlen = 64, \
48 .prefixlen = 4, \
55 .prefixlen = 8, \
63 siphash24_compress(&a->prefixlen, sizeof(a->prefixlen), state); in in_addr_prefix_hash_func()
77 r = CMP(x->prefixlen, y->prefixlen); in in_addr_prefix_compare_func()
98 (void) in_addr_mask(copy->family, &copy->address, copy->prefixlen); in in_addr_prefix_add()
113 assert(p->prefixlen <= 32); in in_addr_prefixes_reduce()
[all …]
/systemd-251/src/libsystemd-network/
Dsd-radv.c589 (void) in6_addr_prefix_to_string(&p->opt.in6_addr, p->opt.prefixlen, &addr_p); in sd_radv_add_prefix()
595 cur->opt.prefixlen, in sd_radv_add_prefix()
597 p->opt.prefixlen); in sd_radv_add_prefix()
603 if (cur->opt.prefixlen == p->opt.prefixlen) { in sd_radv_add_prefix()
609 (void) in6_addr_prefix_to_string(&cur->opt.in6_addr, cur->opt.prefixlen, &addr_cur); in sd_radv_add_prefix()
660 unsigned char prefixlen) { in sd_radv_remove_prefix() argument
669 if (prefixlen != cur->opt.prefixlen) in sd_radv_remove_prefix()
690 (void) in6_addr_prefix_to_string(&p->opt.in6_addr, p->opt.prefixlen, &addr_p); in sd_radv_add_route_prefix()
696 cur->opt.prefixlen, in sd_radv_add_route_prefix()
698 p->opt.prefixlen); in sd_radv_add_route_prefix()
[all …]
Dtest-dhcp6-client.c796 uint8_t *id, prefixlen; in test_lease_managed() local
827 assert_se(sd_dhcp6_lease_get_pd(lease, &addr, &prefixlen, &lt_pref, &lt_valid) >= 0); in test_lease_managed()
829 assert_se(prefixlen == 64); in test_lease_managed()
832 assert_se(sd_dhcp6_lease_get_pd(lease, &addr, &prefixlen, &lt_pref, &lt_valid) >= 0); in test_lease_managed()
834 assert_se(prefixlen == 64); in test_lease_managed()
840 assert_se(sd_dhcp6_lease_get_pd(lease, &addr, &prefixlen, &lt_pref, &lt_valid) >= 0); in test_lease_managed()
842 assert_se(prefixlen == 64); in test_lease_managed()
845 assert_se(sd_dhcp6_lease_get_pd(lease, &addr, &prefixlen, &lt_pref, &lt_valid) >= 0); in test_lease_managed()
847 assert_se(prefixlen == 64); in test_lease_managed()
Dsd-dhcp-lease.c495 uint8_t prefixlen; in lease_parse_static_routes() local
505 r = in4_addr_default_prefixlen(&dst, &prefixlen); in lease_parse_static_routes()
511 (void) in4_addr_mask(&dst, prefixlen); in lease_parse_static_routes()
519 .dst_prefixlen = prefixlen, in lease_parse_static_routes()
534 uint8_t prefixlen, dst_octets; in lease_parse_classless_routes() local
537 prefixlen = *option; in lease_parse_classless_routes()
541 dst_octets = DIV_ROUND_UP(prefixlen, 8); in lease_parse_classless_routes()
564 .dst_prefixlen = prefixlen, in lease_parse_classless_routes()
572 uint8_t ipv4masklen, prefixlen; in lease_parse_6rd() local
601 prefixlen = option[1]; in lease_parse_6rd()
[all …]
/systemd-251/src/network/generator/
Dnetwork-generator.c85 static int address_new(Network *network, int family, unsigned char prefixlen, in address_new() argument
97 .prefixlen = prefixlen, in address_new()
121 static int route_new(Network *network, int family, unsigned char prefixlen, in route_new() argument
133 .prefixlen = prefixlen, in route_new()
387 … int network_set_address(Context *context, const char *ifname, int family, unsigned char prefixlen, in network_set_address() argument
398 return address_new(network, family, prefixlen, addr, peer, NULL); in network_set_address()
401 …ic int network_set_route(Context *context, const char *ifname, int family, unsigned char prefixlen, in network_set_route() argument
416 return route_new(network, family, prefixlen, dest, gateway, NULL); in network_set_route()
594 unsigned char prefixlen; in parse_cmdline_ip_address() local
609 r = parse_netmask_or_prefixlen(family, &value, &prefixlen); in parse_cmdline_ip_address()
[all …]
/systemd-251/src/libsystemd/sd-netlink/
Dnetlink-message-rtnl.c20 int sd_rtnl_message_route_set_dst_prefixlen(sd_netlink_message *m, unsigned char prefixlen) { in sd_rtnl_message_route_set_dst_prefixlen() argument
29 if ((rtm->rtm_family == AF_INET && prefixlen > 32) || in sd_rtnl_message_route_set_dst_prefixlen()
30 (rtm->rtm_family == AF_INET6 && prefixlen > 128)) in sd_rtnl_message_route_set_dst_prefixlen()
33 rtm->rtm_dst_len = prefixlen; in sd_rtnl_message_route_set_dst_prefixlen()
38 int sd_rtnl_message_route_set_src_prefixlen(sd_netlink_message *m, unsigned char prefixlen) { in sd_rtnl_message_route_set_src_prefixlen() argument
47 if ((rtm->rtm_family == AF_INET && prefixlen > 32) || in sd_rtnl_message_route_set_src_prefixlen()
48 (rtm->rtm_family == AF_INET6 && prefixlen > 128)) in sd_rtnl_message_route_set_src_prefixlen()
51 rtm->rtm_src_len = prefixlen; in sd_rtnl_message_route_set_src_prefixlen()
544 int sd_rtnl_message_addr_set_prefixlen(sd_netlink_message *m, unsigned char prefixlen) { in sd_rtnl_message_addr_set_prefixlen() argument
553 if ((ifa->ifa_family == AF_INET && prefixlen > 32) || in sd_rtnl_message_addr_set_prefixlen()
[all …]
/systemd-251/src/test/
Dtest-firewall-util.c14 uint8_t prefixlen; in test_v6() local
27 prefixlen = random_u64_range(128 + 1 - 8) + 8; in test_v6()
34 assert_se(fw_add_masquerade(&ctx, true, AF_INET6, &u3, prefixlen) >= 0); in test_v6()
35 assert_se(fw_add_masquerade(&ctx, false, AF_INET6, &u3, prefixlen) >= 0); in test_v6()
Dtest-in-addr-util.c15 unsigned char prefixlen, in test_in_addr_prefix_from_string_one() argument
32 assert_se(l == prefixlen); in test_in_addr_prefix_from_string_one()
39 assert_se(l == prefixlen); in test_in_addr_prefix_from_string_one()
310 unsigned prefixlen, in test_in_addr_prefix_range_one() argument
316 log_debug("/* %s(%s, prefixlen=%u) */", __func__, in, prefixlen); in test_in_addr_prefix_range_one()
319 assert_se((in_addr_prefix_range(family, &a, prefixlen, &s, &e) >= 0) == !!expected_start); in test_in_addr_prefix_range_one()
Dtest-bpf-firewall.c130 .prefixlen = 24 })); in main()
134 .prefixlen = 32 })); in main()
138 .prefixlen = 25 })); in main()
142 .prefixlen = 24 })); in main()
/systemd-251/src/systemd/
Dsd-radv.h62 void sd_radv_remove_prefix(sd_radv *ra, const struct in6_addr *prefix, unsigned char prefixlen);
73 unsigned char prefixlen);
86 …efix_set_prefix(sd_radv_route_prefix *p, const struct in6_addr *in6_addr, unsigned char prefixlen);

123