Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #include <linux/module.h> |
| 3 | #include <linux/netfilter/nf_tables.h> |
| 4 | #include <net/netfilter/nf_tables.h> |
| 5 | #include <net/netfilter/nf_tables_core.h> |
| 6 | #include <net/netfilter/nf_socket.h> |
| 7 | #include <net/inet_sock.h> |
Máté Eckl | 8d6e555 | 2018-06-01 14:54:07 +0200 | [diff] [blame] | 8 | #include <net/tcp.h> |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 9 | |
| 10 | struct nft_socket { |
| 11 | enum nft_socket_keys key:8; |
Florian Westphal | 7f3287d | 2024-09-07 16:07:49 +0200 | [diff] [blame] | 12 | u8 level; /* cgroupv2 level to extract */ |
| 13 | u8 level_user; /* cgroupv2 level provided by userspace */ |
Pablo Neira Ayuso | d77a721 | 2022-03-14 18:23:09 +0100 | [diff] [blame] | 14 | u8 len; |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 15 | union { |
Pablo Neira Ayuso | 345023b | 2021-01-25 18:27:22 +0100 | [diff] [blame] | 16 | u8 dreg; |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 17 | }; |
| 18 | }; |
| 19 | |
Balazs Scheidler | 67407a4 | 2020-08-29 08:19:15 +0200 | [diff] [blame] | 20 | static void nft_socket_wildcard(const struct nft_pktinfo *pkt, |
| 21 | struct nft_regs *regs, struct sock *sk, |
| 22 | u32 *dest) |
| 23 | { |
| 24 | switch (nft_pf(pkt)) { |
| 25 | case NFPROTO_IPV4: |
| 26 | nft_reg_store8(dest, inet_sk(sk)->inet_rcv_saddr == 0); |
| 27 | break; |
| 28 | #if IS_ENABLED(CONFIG_NF_TABLES_IPV6) |
| 29 | case NFPROTO_IPV6: |
| 30 | nft_reg_store8(dest, ipv6_addr_any(&sk->sk_v6_rcv_saddr)); |
| 31 | break; |
| 32 | #endif |
| 33 | default: |
| 34 | regs->verdict.code = NFT_BREAK; |
| 35 | return; |
| 36 | } |
| 37 | } |
| 38 | |
Arnd Bergmann | 7acc0bb | 2021-04-27 21:45:19 +0200 | [diff] [blame] | 39 | #ifdef CONFIG_SOCK_CGROUP_DATA |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 40 | static noinline bool |
Florian Westphal | 05ae2fb | 2022-04-09 13:20:19 +0200 | [diff] [blame] | 41 | nft_sock_get_eval_cgroupv2(u32 *dest, struct sock *sk, const struct nft_pktinfo *pkt, u32 level) |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 42 | { |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 43 | struct cgroup *cgrp; |
Tejun Heo | 7f203bc | 2022-07-29 13:10:16 -1000 | [diff] [blame] | 44 | u64 cgid; |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 45 | |
Florian Westphal | 05ae2fb | 2022-04-09 13:20:19 +0200 | [diff] [blame] | 46 | if (!sk_fullsock(sk)) |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 47 | return false; |
| 48 | |
Tejun Heo | 7f203bc | 2022-07-29 13:10:16 -1000 | [diff] [blame] | 49 | cgrp = cgroup_ancestor(sock_cgroup_ptr(&sk->sk_cgrp_data), level); |
| 50 | if (!cgrp) |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 51 | return false; |
| 52 | |
Tejun Heo | 7f203bc | 2022-07-29 13:10:16 -1000 | [diff] [blame] | 53 | cgid = cgroup_id(cgrp); |
| 54 | memcpy(dest, &cgid, sizeof(u64)); |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 55 | return true; |
| 56 | } |
Florian Westphal | 7f3287d | 2024-09-07 16:07:49 +0200 | [diff] [blame] | 57 | |
| 58 | /* process context only, uses current->nsproxy. */ |
| 59 | static noinline int nft_socket_cgroup_subtree_level(void) |
| 60 | { |
| 61 | struct cgroup *cgrp = cgroup_get_from_path("/"); |
| 62 | int level; |
| 63 | |
Dan Carpenter | 7052622 | 2024-09-14 12:56:51 +0300 | [diff] [blame] | 64 | if (IS_ERR(cgrp)) |
| 65 | return PTR_ERR(cgrp); |
Florian Westphal | 7f3287d | 2024-09-07 16:07:49 +0200 | [diff] [blame] | 66 | |
| 67 | level = cgrp->level; |
| 68 | |
| 69 | cgroup_put(cgrp); |
| 70 | |
| 71 | if (WARN_ON_ONCE(level > 255)) |
| 72 | return -ERANGE; |
| 73 | |
| 74 | if (WARN_ON_ONCE(level < 0)) |
| 75 | return -EINVAL; |
| 76 | |
| 77 | return level; |
| 78 | } |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 79 | #endif |
| 80 | |
Florian Westphal | 743b83f | 2022-04-28 09:39:21 +0200 | [diff] [blame] | 81 | static struct sock *nft_socket_do_lookup(const struct nft_pktinfo *pkt) |
| 82 | { |
| 83 | const struct net_device *indev = nft_in(pkt); |
| 84 | const struct sk_buff *skb = pkt->skb; |
| 85 | struct sock *sk = NULL; |
| 86 | |
| 87 | if (!indev) |
| 88 | return NULL; |
| 89 | |
| 90 | switch (nft_pf(pkt)) { |
| 91 | case NFPROTO_IPV4: |
| 92 | sk = nf_sk_lookup_slow_v4(nft_net(pkt), skb, indev); |
| 93 | break; |
| 94 | #if IS_ENABLED(CONFIG_NF_TABLES_IPV6) |
| 95 | case NFPROTO_IPV6: |
| 96 | sk = nf_sk_lookup_slow_v6(nft_net(pkt), skb, indev); |
| 97 | break; |
| 98 | #endif |
| 99 | default: |
| 100 | WARN_ON_ONCE(1); |
| 101 | break; |
| 102 | } |
| 103 | |
| 104 | return sk; |
| 105 | } |
| 106 | |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 107 | static void nft_socket_eval(const struct nft_expr *expr, |
| 108 | struct nft_regs *regs, |
| 109 | const struct nft_pktinfo *pkt) |
| 110 | { |
| 111 | const struct nft_socket *priv = nft_expr_priv(expr); |
| 112 | struct sk_buff *skb = pkt->skb; |
| 113 | struct sock *sk = skb->sk; |
| 114 | u32 *dest = ®s->data[priv->dreg]; |
| 115 | |
Flavio Leitner | f564650 | 2018-06-27 10:34:25 -0300 | [diff] [blame] | 116 | if (sk && !net_eq(nft_net(pkt), sock_net(sk))) |
| 117 | sk = NULL; |
| 118 | |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 119 | if (!sk) |
Florian Westphal | 743b83f | 2022-04-28 09:39:21 +0200 | [diff] [blame] | 120 | sk = nft_socket_do_lookup(pkt); |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 121 | |
Flavio Leitner | f564650 | 2018-06-27 10:34:25 -0300 | [diff] [blame] | 122 | if (!sk) { |
Máté Eckl | 365b5a3 | 2018-07-12 17:18:46 +0200 | [diff] [blame] | 123 | regs->verdict.code = NFT_BREAK; |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 124 | return; |
| 125 | } |
| 126 | |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 127 | switch(priv->key) { |
| 128 | case NFT_SOCKET_TRANSPARENT: |
Máté Eckl | 8d6e555 | 2018-06-01 14:54:07 +0200 | [diff] [blame] | 129 | nft_reg_store8(dest, inet_sk_transparent(sk)); |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 130 | break; |
Máté Eckl | 7d25f88 | 2018-07-12 17:48:06 +0200 | [diff] [blame] | 131 | case NFT_SOCKET_MARK: |
| 132 | if (sk_fullsock(sk)) { |
Eric Dumazet | 3c5b4d6 | 2023-07-28 15:03:15 +0000 | [diff] [blame] | 133 | *dest = READ_ONCE(sk->sk_mark); |
Máté Eckl | 7d25f88 | 2018-07-12 17:48:06 +0200 | [diff] [blame] | 134 | } else { |
| 135 | regs->verdict.code = NFT_BREAK; |
Florian Westphal | 8b26ff7 | 2024-09-05 12:54:46 +0200 | [diff] [blame] | 136 | goto out_put_sk; |
Máté Eckl | 7d25f88 | 2018-07-12 17:48:06 +0200 | [diff] [blame] | 137 | } |
| 138 | break; |
Balazs Scheidler | 67407a4 | 2020-08-29 08:19:15 +0200 | [diff] [blame] | 139 | case NFT_SOCKET_WILDCARD: |
| 140 | if (!sk_fullsock(sk)) { |
| 141 | regs->verdict.code = NFT_BREAK; |
Florian Westphal | 8b26ff7 | 2024-09-05 12:54:46 +0200 | [diff] [blame] | 142 | goto out_put_sk; |
Balazs Scheidler | 67407a4 | 2020-08-29 08:19:15 +0200 | [diff] [blame] | 143 | } |
| 144 | nft_socket_wildcard(pkt, regs, sk, dest); |
| 145 | break; |
Arnd Bergmann | 7acc0bb | 2021-04-27 21:45:19 +0200 | [diff] [blame] | 146 | #ifdef CONFIG_SOCK_CGROUP_DATA |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 147 | case NFT_SOCKET_CGROUPV2: |
Florian Westphal | 05ae2fb | 2022-04-09 13:20:19 +0200 | [diff] [blame] | 148 | if (!nft_sock_get_eval_cgroupv2(dest, sk, pkt, priv->level)) { |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 149 | regs->verdict.code = NFT_BREAK; |
Florian Westphal | 8b26ff7 | 2024-09-05 12:54:46 +0200 | [diff] [blame] | 150 | goto out_put_sk; |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 151 | } |
| 152 | break; |
| 153 | #endif |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 154 | default: |
| 155 | WARN_ON(1); |
| 156 | regs->verdict.code = NFT_BREAK; |
| 157 | } |
Fernando Fernandez Mancera | 039b1f4 | 2019-09-01 11:48:08 +0200 | [diff] [blame] | 158 | |
Florian Westphal | 8b26ff7 | 2024-09-05 12:54:46 +0200 | [diff] [blame] | 159 | out_put_sk: |
Fernando Fernandez Mancera | 039b1f4 | 2019-09-01 11:48:08 +0200 | [diff] [blame] | 160 | if (sk != skb->sk) |
| 161 | sock_gen_put(sk); |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | static const struct nla_policy nft_socket_policy[NFTA_SOCKET_MAX + 1] = { |
Florian Westphal | a412dbf | 2023-06-21 21:11:03 +0200 | [diff] [blame] | 165 | [NFTA_SOCKET_KEY] = NLA_POLICY_MAX(NLA_BE32, 255), |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 166 | [NFTA_SOCKET_DREG] = { .type = NLA_U32 }, |
Florian Westphal | a412dbf | 2023-06-21 21:11:03 +0200 | [diff] [blame] | 167 | [NFTA_SOCKET_LEVEL] = NLA_POLICY_MAX(NLA_BE32, 255), |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 168 | }; |
| 169 | |
| 170 | static int nft_socket_init(const struct nft_ctx *ctx, |
| 171 | const struct nft_expr *expr, |
| 172 | const struct nlattr * const tb[]) |
| 173 | { |
| 174 | struct nft_socket *priv = nft_expr_priv(expr); |
Arnd Bergmann | 8a7363f | 2021-04-27 21:45:18 +0200 | [diff] [blame] | 175 | unsigned int len; |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 176 | |
| 177 | if (!tb[NFTA_SOCKET_DREG] || !tb[NFTA_SOCKET_KEY]) |
| 178 | return -EINVAL; |
| 179 | |
| 180 | switch(ctx->family) { |
| 181 | case NFPROTO_IPV4: |
Máté Eckl | 5d400a4 | 2018-07-10 16:01:28 +0200 | [diff] [blame] | 182 | #if IS_ENABLED(CONFIG_NF_TABLES_IPV6) |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 183 | case NFPROTO_IPV6: |
| 184 | #endif |
| 185 | case NFPROTO_INET: |
| 186 | break; |
| 187 | default: |
| 188 | return -EOPNOTSUPP; |
| 189 | } |
| 190 | |
Florian Westphal | d86473b | 2022-06-23 15:05:11 +0200 | [diff] [blame] | 191 | priv->key = ntohl(nla_get_be32(tb[NFTA_SOCKET_KEY])); |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 192 | switch(priv->key) { |
| 193 | case NFT_SOCKET_TRANSPARENT: |
Balazs Scheidler | 67407a4 | 2020-08-29 08:19:15 +0200 | [diff] [blame] | 194 | case NFT_SOCKET_WILDCARD: |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 195 | len = sizeof(u8); |
| 196 | break; |
Máté Eckl | 7d25f88 | 2018-07-12 17:48:06 +0200 | [diff] [blame] | 197 | case NFT_SOCKET_MARK: |
| 198 | len = sizeof(u32); |
| 199 | break; |
Florian Westphal | 7f3287d | 2024-09-07 16:07:49 +0200 | [diff] [blame] | 200 | #ifdef CONFIG_SOCK_CGROUP_DATA |
Arnd Bergmann | 8a7363f | 2021-04-27 21:45:18 +0200 | [diff] [blame] | 201 | case NFT_SOCKET_CGROUPV2: { |
| 202 | unsigned int level; |
Florian Westphal | 7f3287d | 2024-09-07 16:07:49 +0200 | [diff] [blame] | 203 | int err; |
Arnd Bergmann | 8a7363f | 2021-04-27 21:45:18 +0200 | [diff] [blame] | 204 | |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 205 | if (!tb[NFTA_SOCKET_LEVEL]) |
| 206 | return -EINVAL; |
| 207 | |
Florian Westphal | d86473b | 2022-06-23 15:05:11 +0200 | [diff] [blame] | 208 | level = ntohl(nla_get_be32(tb[NFTA_SOCKET_LEVEL])); |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 209 | if (level > 255) |
| 210 | return -EOPNOTSUPP; |
| 211 | |
Florian Westphal | 7f3287d | 2024-09-07 16:07:49 +0200 | [diff] [blame] | 212 | err = nft_socket_cgroup_subtree_level(); |
| 213 | if (err < 0) |
| 214 | return err; |
| 215 | |
| 216 | priv->level_user = level; |
| 217 | |
| 218 | level += err; |
| 219 | /* Implies a giant cgroup tree */ |
| 220 | if (WARN_ON_ONCE(level > 255)) |
| 221 | return -EOPNOTSUPP; |
| 222 | |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 223 | priv->level = level; |
| 224 | len = sizeof(u64); |
| 225 | break; |
Arnd Bergmann | 8a7363f | 2021-04-27 21:45:18 +0200 | [diff] [blame] | 226 | } |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 227 | #endif |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 228 | default: |
| 229 | return -EOPNOTSUPP; |
| 230 | } |
| 231 | |
Pablo Neira Ayuso | d77a721 | 2022-03-14 18:23:09 +0100 | [diff] [blame] | 232 | priv->len = len; |
Pablo Neira Ayuso | 345023b | 2021-01-25 18:27:22 +0100 | [diff] [blame] | 233 | return nft_parse_register_store(ctx, tb[NFTA_SOCKET_DREG], &priv->dreg, |
| 234 | NULL, NFT_DATA_VALUE, len); |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 235 | } |
| 236 | |
| 237 | static int nft_socket_dump(struct sk_buff *skb, |
Phil Sutter | 7d34aa3 | 2022-10-14 23:45:58 +0200 | [diff] [blame] | 238 | const struct nft_expr *expr, bool reset) |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 239 | { |
| 240 | const struct nft_socket *priv = nft_expr_priv(expr); |
| 241 | |
Florian Westphal | d86473b | 2022-06-23 15:05:11 +0200 | [diff] [blame] | 242 | if (nla_put_be32(skb, NFTA_SOCKET_KEY, htonl(priv->key))) |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 243 | return -1; |
| 244 | if (nft_dump_register(skb, NFTA_SOCKET_DREG, priv->dreg)) |
| 245 | return -1; |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 246 | if (priv->key == NFT_SOCKET_CGROUPV2 && |
Florian Westphal | 7f3287d | 2024-09-07 16:07:49 +0200 | [diff] [blame] | 247 | nla_put_be32(skb, NFTA_SOCKET_LEVEL, htonl(priv->level_user))) |
Pablo Neira Ayuso | e0bb96d | 2021-04-21 01:12:44 +0200 | [diff] [blame] | 248 | return -1; |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 249 | return 0; |
| 250 | } |
| 251 | |
Pablo Neira Ayuso | d77a721 | 2022-03-14 18:23:09 +0100 | [diff] [blame] | 252 | static bool nft_socket_reduce(struct nft_regs_track *track, |
| 253 | const struct nft_expr *expr) |
| 254 | { |
| 255 | const struct nft_socket *priv = nft_expr_priv(expr); |
| 256 | const struct nft_socket *socket; |
| 257 | |
| 258 | if (!nft_reg_track_cmp(track, expr, priv->dreg)) { |
| 259 | nft_reg_track_update(track, expr, priv->dreg, priv->len); |
| 260 | return false; |
| 261 | } |
| 262 | |
| 263 | socket = nft_expr_priv(track->regs[priv->dreg].selector); |
| 264 | if (priv->key != socket->key || |
| 265 | priv->dreg != socket->dreg || |
| 266 | priv->level != socket->level) { |
| 267 | nft_reg_track_update(track, expr, priv->dreg, priv->len); |
| 268 | return false; |
| 269 | } |
| 270 | |
| 271 | if (!track->regs[priv->dreg].bitwise) |
| 272 | return true; |
| 273 | |
| 274 | return nft_expr_reduce_bitwise(track, expr); |
| 275 | } |
| 276 | |
Florian Westphal | 743b83f | 2022-04-28 09:39:21 +0200 | [diff] [blame] | 277 | static int nft_socket_validate(const struct nft_ctx *ctx, |
Florian Westphal | eaf9b2c | 2024-08-28 11:34:02 +0200 | [diff] [blame] | 278 | const struct nft_expr *expr) |
Florian Westphal | 743b83f | 2022-04-28 09:39:21 +0200 | [diff] [blame] | 279 | { |
Pablo Neira Ayuso | d0009ef | 2024-01-23 16:38:25 +0100 | [diff] [blame] | 280 | if (ctx->family != NFPROTO_IPV4 && |
| 281 | ctx->family != NFPROTO_IPV6 && |
| 282 | ctx->family != NFPROTO_INET) |
| 283 | return -EOPNOTSUPP; |
| 284 | |
Florian Westphal | 743b83f | 2022-04-28 09:39:21 +0200 | [diff] [blame] | 285 | return nft_chain_validate_hooks(ctx->chain, |
| 286 | (1 << NF_INET_PRE_ROUTING) | |
| 287 | (1 << NF_INET_LOCAL_IN) | |
| 288 | (1 << NF_INET_LOCAL_OUT)); |
| 289 | } |
| 290 | |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 291 | static struct nft_expr_type nft_socket_type; |
| 292 | static const struct nft_expr_ops nft_socket_ops = { |
| 293 | .type = &nft_socket_type, |
| 294 | .size = NFT_EXPR_SIZE(sizeof(struct nft_socket)), |
| 295 | .eval = nft_socket_eval, |
| 296 | .init = nft_socket_init, |
| 297 | .dump = nft_socket_dump, |
Florian Westphal | 743b83f | 2022-04-28 09:39:21 +0200 | [diff] [blame] | 298 | .validate = nft_socket_validate, |
Pablo Neira Ayuso | d77a721 | 2022-03-14 18:23:09 +0100 | [diff] [blame] | 299 | .reduce = nft_socket_reduce, |
Máté Eckl | 554ced0 | 2018-05-28 09:15:33 +0200 | [diff] [blame] | 300 | }; |
| 301 | |
| 302 | static struct nft_expr_type nft_socket_type __read_mostly = { |
| 303 | .name = "socket", |
| 304 | .ops = &nft_socket_ops, |
| 305 | .policy = nft_socket_policy, |
| 306 | .maxattr = NFTA_SOCKET_MAX, |
| 307 | .owner = THIS_MODULE, |
| 308 | }; |
| 309 | |
| 310 | static int __init nft_socket_module_init(void) |
| 311 | { |
| 312 | return nft_register_expr(&nft_socket_type); |
| 313 | } |
| 314 | |
| 315 | static void __exit nft_socket_module_exit(void) |
| 316 | { |
| 317 | nft_unregister_expr(&nft_socket_type); |
| 318 | } |
| 319 | |
| 320 | module_init(nft_socket_module_init); |
| 321 | module_exit(nft_socket_module_exit); |
| 322 | |
| 323 | MODULE_LICENSE("GPL"); |
| 324 | MODULE_AUTHOR("Máté Eckl"); |
| 325 | MODULE_DESCRIPTION("nf_tables socket match module"); |
Pablo Neira Ayuso | 3fb61ec | 2018-06-07 17:56:08 +0200 | [diff] [blame] | 326 | MODULE_ALIAS_NFT_EXPR("socket"); |