Skip to content

Commit a6b267b

Browse files
committed
unix: Add Netfilter and NFTables constants
Fixes golang/go#64426
1 parent 13b15b7 commit a6b267b

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

unix/mkerrors.sh

+22
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ struct ltchars {
248248
#include <linux/module.h>
249249
#include <linux/mount.h>
250250
#include <linux/netfilter/nfnetlink.h>
251+
#include <linux/netfilter/nf_tables.h>
251252
#include <linux/netlink.h>
252253
#include <linux/net_namespace.h>
253254
#include <linux/nfc.h>
@@ -324,6 +325,24 @@ struct ltchars {
324325
// and netinet/in.h included via net/route.h above.
325326
#define IPPROTO_L2TP 115
326327
328+
// Copied from linux/netfilter/nf_nat.h
329+
// Including linux/netfilter/nf_nat.h here causes conflicts between linux/in.h
330+
// and netinet/in.h.
331+
#define NF_NAT_RANGE_MAP_IPS (1 << 0)
332+
#define NF_NAT_RANGE_PROTO_SPECIFIED (1 << 1)
333+
#define NF_NAT_RANGE_PROTO_RANDOM (1 << 2)
334+
#define NF_NAT_RANGE_PERSISTENT (1 << 3)
335+
#define NF_NAT_RANGE_PROTO_RANDOM_FULLY (1 << 4)
336+
#define NF_NAT_RANGE_PROTO_OFFSET (1 << 5)
337+
#define NF_NAT_RANGE_NETMAP (1 << 6)
338+
#define NF_NAT_RANGE_PROTO_RANDOM_ALL \
339+
(NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY)
340+
#define NF_NAT_RANGE_MASK \
341+
(NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED | \
342+
NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT | \
343+
NF_NAT_RANGE_PROTO_RANDOM_FULLY | NF_NAT_RANGE_PROTO_OFFSET | \
344+
NF_NAT_RANGE_NETMAP)
345+
327346
// Copied from linux/hid.h.
328347
// Keep in sync with the size of the referenced fields.
329348
#define _HIDIOCGRAWNAME_LEN 128 // sizeof_field(struct hid_device, name)
@@ -603,6 +622,9 @@ ccflags="$@"
603622
$2 ~ /^FSOPT_/ ||
604623
$2 ~ /^WDIO[CFS]_/ ||
605624
$2 ~ /^NFN/ ||
625+
$2 !~ /^NFT_META_IIFTYPE/ &&
626+
$2 ~ /^NFT_/ ||
627+
$2 ~ /^NF_NAT_/ ||
606628
$2 ~ /^XDP_/ ||
607629
$2 ~ /^RWF_/ ||
608630
$2 ~ /^(HDIO|WIN|SMART)_/ ||

unix/zerrors_linux.go

+54
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)