root/include/linux/netfilter/ipset/ip_set_bitmap.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. range_to_mask

   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 #ifndef __IP_SET_BITMAP_H
   3 #define __IP_SET_BITMAP_H
   4 
   5 #include <uapi/linux/netfilter/ipset/ip_set_bitmap.h>
   6 
   7 #define IPSET_BITMAP_MAX_RANGE  0x0000FFFF
   8 
   9 enum {
  10         IPSET_ADD_STORE_PLAIN_TIMEOUT = -1,
  11         IPSET_ADD_FAILED = 1,
  12         IPSET_ADD_START_STORED_TIMEOUT,
  13 };
  14 
  15 /* Common functions */
  16 
  17 static inline u32
  18 range_to_mask(u32 from, u32 to, u8 *bits)
  19 {
  20         u32 mask = 0xFFFFFFFE;
  21 
  22         *bits = 32;
  23         while (--(*bits) > 0 && mask && (to & mask) != from)
  24                 mask <<= 1;
  25 
  26         return mask;
  27 }
  28 
  29 #endif /* __IP_SET_BITMAP_H */

/* [<][>][^][v][top][bottom][index][help] */