| .. | .. |
|---|
| 4 | 4 | |
|---|
| 5 | 5 | #include <linux/netlink.h> |
|---|
| 6 | 6 | #include <linux/capability.h> |
|---|
| 7 | +#include <linux/android_kabi.h> |
|---|
| 7 | 8 | #include <net/netlink.h> |
|---|
| 8 | 9 | #include <uapi/linux/netfilter/nfnetlink.h> |
|---|
| 9 | 10 | |
|---|
| .. | .. |
|---|
| 22 | 23 | struct netlink_ext_ack *extack); |
|---|
| 23 | 24 | const struct nla_policy *policy; /* netlink attribute policy */ |
|---|
| 24 | 25 | const u_int16_t attr_count; /* number of nlattr's */ |
|---|
| 26 | + |
|---|
| 27 | + ANDROID_KABI_RESERVE(1); |
|---|
| 28 | +}; |
|---|
| 29 | + |
|---|
| 30 | +enum nfnl_abort_action { |
|---|
| 31 | + NFNL_ABORT_NONE = 0, |
|---|
| 32 | + NFNL_ABORT_AUTOLOAD, |
|---|
| 33 | + NFNL_ABORT_VALIDATE, |
|---|
| 25 | 34 | }; |
|---|
| 26 | 35 | |
|---|
| 27 | 36 | struct nfnetlink_subsystem { |
|---|
| .. | .. |
|---|
| 31 | 40 | const struct nfnl_callback *cb; /* callback for individual types */ |
|---|
| 32 | 41 | struct module *owner; |
|---|
| 33 | 42 | int (*commit)(struct net *net, struct sk_buff *skb); |
|---|
| 34 | | - int (*abort)(struct net *net, struct sk_buff *skb); |
|---|
| 35 | | - void (*cleanup)(struct net *net); |
|---|
| 43 | + int (*abort)(struct net *net, struct sk_buff *skb, |
|---|
| 44 | + enum nfnl_abort_action action); |
|---|
| 36 | 45 | bool (*valid_genid)(struct net *net, u32 genid); |
|---|
| 46 | + |
|---|
| 47 | + ANDROID_KABI_RESERVE(1); |
|---|
| 37 | 48 | }; |
|---|
| 38 | 49 | |
|---|
| 39 | 50 | int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); |
|---|
| .. | .. |
|---|
| 50 | 61 | return subsys << 8 | msg_type; |
|---|
| 51 | 62 | } |
|---|
| 52 | 63 | |
|---|
| 64 | +static inline void nfnl_fill_hdr(struct nlmsghdr *nlh, u8 family, u8 version, |
|---|
| 65 | + __be16 res_id) |
|---|
| 66 | +{ |
|---|
| 67 | + struct nfgenmsg *nfmsg; |
|---|
| 68 | + |
|---|
| 69 | + nfmsg = nlmsg_data(nlh); |
|---|
| 70 | + nfmsg->nfgen_family = family; |
|---|
| 71 | + nfmsg->version = version; |
|---|
| 72 | + nfmsg->res_id = res_id; |
|---|
| 73 | +} |
|---|
| 74 | + |
|---|
| 75 | +static inline struct nlmsghdr *nfnl_msg_put(struct sk_buff *skb, u32 portid, |
|---|
| 76 | + u32 seq, int type, int flags, |
|---|
| 77 | + u8 family, u8 version, |
|---|
| 78 | + __be16 res_id) |
|---|
| 79 | +{ |
|---|
| 80 | + struct nlmsghdr *nlh; |
|---|
| 81 | + |
|---|
| 82 | + nlh = nlmsg_put(skb, portid, seq, type, sizeof(struct nfgenmsg), flags); |
|---|
| 83 | + if (!nlh) |
|---|
| 84 | + return NULL; |
|---|
| 85 | + |
|---|
| 86 | + nfnl_fill_hdr(nlh, family, version, res_id); |
|---|
| 87 | + |
|---|
| 88 | + return nlh; |
|---|
| 89 | +} |
|---|
| 90 | + |
|---|
| 53 | 91 | void nfnl_lock(__u8 subsys_id); |
|---|
| 54 | 92 | void nfnl_unlock(__u8 subsys_id); |
|---|
| 55 | 93 | #ifdef CONFIG_PROVE_LOCKING |
|---|