Lines Matching refs:cidr

101 	u32 nets[IPSET_NET_COUNT]; /* number of elements for this cidr */
102 u8 cidr[IPSET_NET_COUNT]; /* the cidr value */
124 #define __CIDR(cidr, i) (cidr[i])
126 #define __CIDR(cidr, i) (cidr)
129 /* cidr + 1 is stored in net_prefixes to support /0 */
130 #define NCIDR_PUT(cidr) ((cidr) + 1)
131 #define NCIDR_GET(cidr) ((cidr) - 1)
134 /* When cidr is packed with nomatch, cidr - 1 is stored in the data entry */
135 #define DCIDR_PUT(cidr) ((cidr) - 1)
136 #define DCIDR_GET(cidr, i) (__CIDR(cidr, i) + 1)
138 #define DCIDR_PUT(cidr) (cidr)
139 #define DCIDR_GET(cidr, i) __CIDR(cidr, i)
142 #define INIT_CIDR(cidr, host_mask) \
143 DCIDR_PUT(((cidr) ? NCIDR_GET(cidr) : host_mask))
146 /* cidr from 0 to HOST_MASK value and c = cidr + 1 */
150 /* cidr from 1 to HOST_MASK value and c = cidr + 1 */
322 /* Network cidr size book keeping when the hash stores different
323 * sized networks. cidr == real cidr + 1 to support /0.
326 mtype_add_cidr(struct ip_set *set, struct htype *h, u8 cidr, u8 n)
331 /* Add in increasing prefix order, so larger cidr first */
332 for (i = 0, j = -1; i < NLEN && h->nets[i].cidr[n]; i++) {
335 } else if (h->nets[i].cidr[n] < cidr) {
337 } else if (h->nets[i].cidr[n] == cidr) {
338 h->nets[CIDR_POS(cidr)].nets[n]++;
344 h->nets[i].cidr[n] = h->nets[i - 1].cidr[n];
346 h->nets[i].cidr[n] = cidr;
347 h->nets[CIDR_POS(cidr)].nets[n] = 1;
353 mtype_del_cidr(struct ip_set *set, struct htype *h, u8 cidr, u8 n)
359 if (h->nets[i].cidr[n] != cidr)
361 h->nets[CIDR_POS(cidr)].nets[n]--;
362 if (h->nets[CIDR_POS(cidr)].nets[n] > 0)
364 for (j = i; j < net_end && h->nets[j].cidr[n]; j++)
365 h->nets[j].cidr[n] = h->nets[j + 1].cidr[n];
366 h->nets[j].cidr[n] = 0;
515 NCIDR_PUT(DCIDR_GET(data->cidr, k)),
925 NCIDR_PUT(DCIDR_GET(data->cidr, i)),
971 mtype_add_cidr(set, h, NCIDR_PUT(DCIDR_GET(d->cidr, i)), i);
1081 NCIDR_PUT(DCIDR_GET(d->cidr, j)), j);
1176 for (; j < NLEN && h->nets[j].cidr[0] && !multi; j++) {
1179 mtype_data_netmask(d, NCIDR_GET(h->nets[j].cidr[0]), false);
1180 for (k = 0; k < NLEN && h->nets[k].cidr[1] && !multi;
1182 mtype_data_netmask(d, NCIDR_GET(h->nets[k].cidr[1]),
1185 mtype_data_netmask(d, NCIDR_GET(h->nets[j].cidr[0]));
1233 if (DCIDR_GET(d->cidr, i) != HOST_MASK)