treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500
[linux-2.6-block.git] / include / linux / netfilter / ipset / ip_set_skbinfo.h
CommitLineData
d2912cb1 1/* SPDX-License-Identifier: GPL-2.0-only */
57982edc
JK
2#ifndef _IP_SET_SKBINFO_H
3#define _IP_SET_SKBINFO_H
4
5/* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
57982edc
JK
6 */
7
8#ifdef __KERNEL__
9
10static inline void
11ip_set_get_skbinfo(struct ip_set_skbinfo *skbinfo,
12 const struct ip_set_ext *ext,
13 struct ip_set_ext *mext, u32 flags)
14{
15 mext->skbinfo = *skbinfo;
16}
17
18static inline bool
19ip_set_put_skbinfo(struct sk_buff *skb, const struct ip_set_skbinfo *skbinfo)
20{
21 /* Send nonzero parameters only */
22 return ((skbinfo->skbmark || skbinfo->skbmarkmask) &&
23 nla_put_net64(skb, IPSET_ATTR_SKBMARK,
24 cpu_to_be64((u64)skbinfo->skbmark << 32 |
25 skbinfo->skbmarkmask),
26 IPSET_ATTR_PAD)) ||
27 (skbinfo->skbprio &&
28 nla_put_net32(skb, IPSET_ATTR_SKBPRIO,
29 cpu_to_be32(skbinfo->skbprio))) ||
30 (skbinfo->skbqueue &&
31 nla_put_net16(skb, IPSET_ATTR_SKBQUEUE,
32 cpu_to_be16(skbinfo->skbqueue)));
33}
34
35static inline void
36ip_set_init_skbinfo(struct ip_set_skbinfo *skbinfo,
37 const struct ip_set_ext *ext)
38{
39 *skbinfo = ext->skbinfo;
40}
41
42#endif /* __KERNEL__ */
43#endif /* _IP_SET_SKBINFO_H */