/linux/net/netfilter/ipset/ |
H A D | ip_set_hash_netnet.c | 52 u8 cidr[2]; member 94 hash_netnet4_data_netmask(struct hash_netnet4_elem *elem, u8 cidr, bool inner) in hash_netnet4_data_netmask() argument 97 elem->ip[1] &= ip_set_netmask(cidr); in hash_netnet4_data_netmask() 98 elem->cidr[1] = cidr; in hash_netnet4_data_netmask() 100 elem->ip[0] &= ip_set_netmask(cidr); in hash_netnet4_data_netmask() 101 elem->cidr[0] = cidr; in hash_netnet4_data_netmask() 113 nla_put_u8(skb, IPSET_ATTR_CIDR, data->cidr[0]) || in hash_netnet4_data_list() 114 nla_put_u8(skb, IPSET_ATTR_CIDR2, data->cidr[1]) || in hash_netnet4_data_list() 138 e->cidr[0] = HOST_MASK; in hash_netnet4_init() 139 e->cidr[1] = HOST_MASK; in hash_netnet4_init() [all …]
|
H A D | ip_set_hash_net.c | 46 u8 cidr; member 57 ip1->cidr == ip2->cidr; in hash_net4_data_equal() 79 hash_net4_data_netmask(struct hash_net4_elem *elem, u8 cidr) in hash_net4_data_netmask() argument 81 elem->ip &= ip_set_netmask(cidr); in hash_net4_data_netmask() 82 elem->cidr = cidr; in hash_net4_data_netmask() 91 nla_put_u8(skb, IPSET_ATTR_CIDR, data->cidr) || in hash_net4_data_list() 120 .cidr = INIT_CIDR(h->nets[0].cidr[0], HOST_MASK), in hash_net4_kadt() 124 if (e.cidr == 0) in hash_net4_kadt() 127 e.cidr = HOST_MASK; in hash_net4_kadt() 130 e.ip &= ip_set_netmask(e.cidr); in hash_net4_kadt() [all …]
|
H A D | ip_set_hash_netportnet.c | 51 u8 cidr[2]; member 99 u8 cidr, bool inner) in hash_netportnet4_data_netmask() argument 102 elem->ip[1] &= ip_set_netmask(cidr); in hash_netportnet4_data_netmask() 103 elem->cidr[1] = cidr; in hash_netportnet4_data_netmask() 105 elem->ip[0] &= ip_set_netmask(cidr); in hash_netportnet4_data_netmask() 106 elem->cidr[0] = cidr; in hash_netportnet4_data_netmask() 119 nla_put_u8(skb, IPSET_ATTR_CIDR, data->cidr[0]) || in hash_netportnet4_data_list() 120 nla_put_u8(skb, IPSET_ATTR_CIDR2, data->cidr[1]) || in hash_netportnet4_data_list() 146 e->cidr[0] = HOST_MASK; in hash_netportnet4_init() 147 e->cidr[1] = HOST_MASK; in hash_netportnet4_init() [all …]
|
H A D | ip_set_hash_ipportnet.c | 56 u8 cidr:7; member 70 ip1->cidr == ip2->cidr && in hash_ipportnet4_data_equal() 94 hash_ipportnet4_data_netmask(struct hash_ipportnet4_elem *elem, u8 cidr) in hash_ipportnet4_data_netmask() argument 96 elem->ip2 &= ip_set_netmask(cidr); in hash_ipportnet4_data_netmask() 97 elem->cidr = cidr - 1; in hash_ipportnet4_data_netmask() 109 nla_put_u8(skb, IPSET_ATTR_CIDR2, data->cidr + 1) || in hash_ipportnet4_data_list() 141 .cidr = INIT_CIDR(h->nets[0].cidr[0], HOST_MASK), in hash_ipportnet4_kadt() 146 e.cidr = HOST_MASK - 1; in hash_ipportnet4_kadt() 154 e.ip2 &= ip_set_netmask(e.cidr + 1); in hash_ipportnet4_kadt() 165 struct hash_ipportnet4_elem e = { .cidr = HOST_MASK - 1 }; in hash_ipportnet4_uadt() [all …]
|
H A D | ip_set_hash_netport.c | 55 u8 cidr:7; member 69 ip1->cidr == ip2->cidr; in hash_netport4_data_equal() 91 hash_netport4_data_netmask(struct hash_netport4_elem *elem, u8 cidr) in hash_netport4_data_netmask() argument 93 elem->ip &= ip_set_netmask(cidr); in hash_netport4_data_netmask() 94 elem->cidr = cidr - 1; in hash_netport4_data_netmask() 105 nla_put_u8(skb, IPSET_ATTR_CIDR, data->cidr + 1) || in hash_netport4_data_list() 136 .cidr = INIT_CIDR(h->nets[0].cidr[0], HOST_MASK), in hash_netport4_kadt() 141 e.cidr = HOST_MASK - 1; in hash_netport4_kadt() 148 e.ip &= ip_set_netmask(e.cidr + 1); in hash_netport4_kadt() 159 struct hash_netport4_elem e = { .cidr = HOST_MASK - 1 }; in hash_netport4_uadt() [all …]
|
H A D | ip_set_hash_netiface.c | 50 u8 cidr; member 59 u8 cidr; member 74 ip1->cidr == ip2->cidr && in hash_netiface4_data_equal() 101 hash_netiface4_data_netmask(struct hash_netiface4_elem *elem, u8 cidr) in hash_netiface4_data_netmask() argument 103 elem->ip &= ip_set_netmask(cidr); in hash_netiface4_data_netmask() 104 elem->cidr = cidr; in hash_netiface4_data_netmask() 117 nla_put_u8(skb, IPSET_ATTR_CIDR, data->cidr) || in hash_netiface4_data_list() 164 .cidr = INIT_CIDR(h->nets[0].cidr[0], HOST_MASK), in hash_netiface4_kadt() 170 e.cidr = HOST_MASK; in hash_netiface4_kadt() 173 e.ip &= ip_set_netmask(e.cidr); in hash_netiface4_kadt() [all …]
|
H A D | ip_set_hash_gen.h | 102 u8 cidr[IPSET_NET_COUNT]; /* the cidr value */ member 124 #define __CIDR(cidr, i) (cidr[i]) argument 126 #define __CIDR(cidr, i) (cidr) argument 130 #define NCIDR_PUT(cidr) ((cidr) + 1) argument 131 #define NCIDR_GET(cidr) ((cidr) - 1) argument 135 #define DCIDR_PUT(cidr) ((cidr) - 1) argument 136 #define DCIDR_GET(cidr, i) (__CIDR(cidr, i) + 1) argument 138 #define DCIDR_PUT(cidr) (cidr) argument 139 #define DCIDR_GET(cidr, i) __CIDR(cidr, i) argument 142 #define INIT_CIDR(cidr, host_mask) \ argument [all …]
|
H A D | ip_set_hash_ipmark.c | 144 u8 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]); in hash_ipmark4_uadt() local 146 if (!cidr || cidr > HOST_MASK) in hash_ipmark4_uadt() 148 ip_set_mask_from_to(ip, ip_to, cidr); in hash_ipmark4_uadt() 250 u8 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]); in hash_ipmark6_uadt() local 252 if (cidr != HOST_MASK) in hash_ipmark6_uadt()
|
H A D | ip_set_hash_ip.c | 143 u8 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]); in hash_ip4_uadt() local 145 if (!cidr || cidr > HOST_MASK) in hash_ip4_uadt() 147 ip_set_mask_from_to(ip, ip_to, cidr); in hash_ip4_uadt() 251 u8 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]); in hash_ip6_uadt() local 253 if (cidr != HOST_MASK) in hash_ip6_uadt()
|
H A D | pfxlen.c | 172 ip_set_range_to_cidr(u32 from, u32 to, u8 *cidr) in ip_set_range_to_cidr() argument 182 *cidr = i; in ip_set_range_to_cidr() 186 *cidr = 32; in ip_set_range_to_cidr()
|
H A D | ip_set_hash_ipportip.c | 169 u8 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]); in hash_ipportip4_uadt() local 171 if (!cidr || cidr > HOST_MASK) in hash_ipportip4_uadt() 173 ip_set_mask_from_to(ip, ip_to, cidr); in hash_ipportip4_uadt() 299 u8 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]); in hash_ipportip6_uadt() local 301 if (cidr != HOST_MASK) in hash_ipportip6_uadt()
|
H A D | ip_set_hash_ipport.c | 173 u8 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]); in hash_ipport4_uadt() local 175 if (!cidr || cidr > HOST_MASK) in hash_ipport4_uadt() 177 ip_set_mask_from_to(ip, ip_to, cidr); in hash_ipport4_uadt() 304 u8 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]); in hash_ipport6_uadt() local 306 if (cidr != HOST_MASK) in hash_ipport6_uadt()
|
H A D | ip_set_bitmap_ipmac.c | 342 u8 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]); in bitmap_ipmac_create() local 344 if (cidr >= HOST_MASK) in bitmap_ipmac_create() 346 ip_set_mask_from_to(first_ip, last_ip, cidr); in bitmap_ipmac_create()
|
/linux/drivers/net/wireguard/ |
H A D | allowedips.c | 24 u8 cidr, u8 bits) in copy_and_assign_cidr() argument 26 node->cidr = cidr; in copy_and_assign_cidr() 27 node->bit_at_a = cidr / 8U; in copy_and_assign_cidr() 31 node->bit_at_b = 7U - (cidr % 8U); in copy_and_assign_cidr() 108 return common_bits(node, key, bits) >= node->cidr; in prefix_matches() 119 if (node->cidr == bits) in find_node() 150 u8 cidr, u8 bits, struct allowedips_node **rnode, in node_placement() argument 157 while (node && node->cidr <= cidr && prefix_matches(node, key, bits)) { in node_placement() 159 if (parent->cidr == cidr) { in node_placement() 182 u8 cidr, struct wg_peer *peer, struct mutex *lock) in add() argument [all …]
|
H A D | allowedips.h | 18 u8 cidr, bit_at_a, bit_at_b, bitlen; member 38 u8 cidr, struct wg_peer *peer, struct mutex *lock); 40 u8 cidr, struct wg_peer *peer, struct mutex *lock); 44 int wg_allowedips_read_node(struct allowedips_node *node, u8 ip[16], u8 *cidr);
|
H A D | netlink.c | 75 static int get_allowedips(struct sk_buff *skb, const u8 *ip, u8 cidr, in get_allowedips() argument 84 if (nla_put_u8(skb, WGALLOWEDIP_A_CIDR_MASK, cidr) || in get_allowedips() 177 u8 cidr, ip[16] __aligned(__alignof(u64)); in get_peer() local 180 family = wg_allowedips_read_node(allowedips_node, ip, &cidr); in get_peer() 181 if (get_allowedips(skb, ip, cidr, family)) { in get_peer() 333 u8 cidr; in set_allowedip() local 339 cidr = nla_get_u8(attrs[WGALLOWEDIP_A_CIDR_MASK]); in set_allowedip() 341 if (family == AF_INET && cidr <= 32 && in set_allowedip() 345 nla_data(attrs[WGALLOWEDIP_A_IPADDR]), cidr, peer, in set_allowedip() 347 else if (family == AF_INET6 && cidr <= 128 && in set_allowedip() [all …]
|
/linux/include/linux/netfilter/ipset/ |
H A D | pfxlen.h | 37 extern u32 ip_set_range_to_cidr(u32 from, u32 to, u8 *cidr); 39 #define ip_set_mask_from_to(from, to, cidr) \ argument 41 from &= ip_set_hostmask(cidr); \ 42 to = from | ~ip_set_hostmask(cidr); \
|