Skip to content

Commit

Permalink
netfilter: ipset: move function to ip_set_bitmap_ip.c.
Browse files Browse the repository at this point in the history
One inline function in ip_set_bitmap.h is only called in
ip_set_bitmap_ip.c: move it and remove inline function specifier.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Acked-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
a3a3el authored and ummakynes committed Oct 7, 2019
1 parent 8563918 commit 3fbd6c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
14 changes: 0 additions & 14 deletions include/linux/netfilter/ipset/ip_set_bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,4 @@ enum {
IPSET_ADD_START_STORED_TIMEOUT,
};

/* Common functions */

static inline u32
range_to_mask(u32 from, u32 to, u8 *bits)
{
u32 mask = 0xFFFFFFFE;

*bits = 32;
while (--(*bits) > 0 && mask && (to & mask) != from)
mask <<= 1;

return mask;
}

#endif /* __IP_SET_BITMAP_H */
12 changes: 12 additions & 0 deletions net/netfilter/ipset/ip_set_bitmap_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,18 @@ init_map_ip(struct ip_set *set, struct bitmap_ip *map,
return true;
}

static u32
range_to_mask(u32 from, u32 to, u8 *bits)
{
u32 mask = 0xFFFFFFFE;

*bits = 32;
while (--(*bits) > 0 && mask && (to & mask) != from)
mask <<= 1;

return mask;
}

static int
bitmap_ip_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
u32 flags)
Expand Down

0 comments on commit 3fbd6c4

Please sign in to comment.