]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
Update kernel headers
authorDavid Ahern <dsahern@gmail.com>
Fri, 26 Apr 2019 18:02:36 +0000 (11:02 -0700)
committerDavid Ahern <dsahern@gmail.com>
Fri, 26 Apr 2019 18:11:03 +0000 (11:11 -0700)
Update kernel headers to commit
    148f025d41a8 ("Merge branch 'hns3-next'")

Note, these warnings:
../include/uapi/linux/sockios.h:42:0: warning: "SIOCGSTAMP" redefined
../include/uapi/linux/sockios.h:43:0: warning: "SIOCGSTAMPNS" redefined

are due to kernel commit
    0768e17073dc5 ("net: socket: implement 64-bit timestamps")

which moved the definitions from include/asm-generic/sockios.h
to include/uapi/linux/sockios.h

Signed-off-by: David Ahern <dsahern@gmail.com>
include/uapi/linux/bpf.h
include/uapi/linux/icmpv6.h
include/uapi/linux/if_vlan.h
include/uapi/linux/sockios.h
include/uapi/linux/tipc.h

index 79f729c669477227566566fe9b99921c08e55aea..fcfd7e3c52b2deccf772020914a4656a7888a37b 100644 (file)
@@ -167,6 +167,7 @@ enum bpf_prog_type {
        BPF_PROG_TYPE_LIRC_MODE2,
        BPF_PROG_TYPE_SK_REUSEPORT,
        BPF_PROG_TYPE_FLOW_DISSECTOR,
+       BPF_PROG_TYPE_CGROUP_SYSCTL,
 };
 
 enum bpf_attach_type {
@@ -188,6 +189,7 @@ enum bpf_attach_type {
        BPF_CGROUP_UDP6_SENDMSG,
        BPF_LIRC_MODE2,
        BPF_FLOW_DISSECTOR,
+       BPF_CGROUP_SYSCTL,
        __MAX_BPF_ATTACH_TYPE
 };
 
@@ -1735,12 +1737,19 @@ union bpf_attr {
  *             error if an eBPF program tries to set a callback that is not
  *             supported in the current kernel.
  *
- *             The supported callback values that *argval* can combine are:
+ *             *argval* is a flag array which can combine these flags:
  *
  *             * **BPF_SOCK_OPS_RTO_CB_FLAG** (retransmission time out)
  *             * **BPF_SOCK_OPS_RETRANS_CB_FLAG** (retransmission)
  *             * **BPF_SOCK_OPS_STATE_CB_FLAG** (TCP state change)
  *
+ *             Therefore, this function can be used to clear a callback flag by
+ *             setting the appropriate bit to zero. e.g. to disable the RTO
+ *             callback:
+ *
+ *             **bpf_sock_ops_cb_flags_set(bpf_sock,**
+ *                     **bpf_sock->bpf_sock_ops_cb_flags & ~BPF_SOCK_OPS_RTO_CB_FLAG)**
+ *
  *             Here are some examples of where one could call such eBPF
  *             program:
  *
@@ -2504,6 +2513,122 @@ union bpf_attr {
  *     Return
  *             0 if iph and th are a valid SYN cookie ACK, or a negative error
  *             otherwise.
+ *
+ * int bpf_sysctl_get_name(struct bpf_sysctl *ctx, char *buf, size_t buf_len, u64 flags)
+ *     Description
+ *             Get name of sysctl in /proc/sys/ and copy it into provided by
+ *             program buffer *buf* of size *buf_len*.
+ *
+ *             The buffer is always NUL terminated, unless it's zero-sized.
+ *
+ *             If *flags* is zero, full name (e.g. "net/ipv4/tcp_mem") is
+ *             copied. Use **BPF_F_SYSCTL_BASE_NAME** flag to copy base name
+ *             only (e.g. "tcp_mem").
+ *     Return
+ *             Number of character copied (not including the trailing NUL).
+ *
+ *             **-E2BIG** if the buffer wasn't big enough (*buf* will contain
+ *             truncated name in this case).
+ *
+ * int bpf_sysctl_get_current_value(struct bpf_sysctl *ctx, char *buf, size_t buf_len)
+ *     Description
+ *             Get current value of sysctl as it is presented in /proc/sys
+ *             (incl. newline, etc), and copy it as a string into provided
+ *             by program buffer *buf* of size *buf_len*.
+ *
+ *             The whole value is copied, no matter what file position user
+ *             space issued e.g. sys_read at.
+ *
+ *             The buffer is always NUL terminated, unless it's zero-sized.
+ *     Return
+ *             Number of character copied (not including the trailing NUL).
+ *
+ *             **-E2BIG** if the buffer wasn't big enough (*buf* will contain
+ *             truncated name in this case).
+ *
+ *             **-EINVAL** if current value was unavailable, e.g. because
+ *             sysctl is uninitialized and read returns -EIO for it.
+ *
+ * int bpf_sysctl_get_new_value(struct bpf_sysctl *ctx, char *buf, size_t buf_len)
+ *     Description
+ *             Get new value being written by user space to sysctl (before
+ *             the actual write happens) and copy it as a string into
+ *             provided by program buffer *buf* of size *buf_len*.
+ *
+ *             User space may write new value at file position > 0.
+ *
+ *             The buffer is always NUL terminated, unless it's zero-sized.
+ *     Return
+ *             Number of character copied (not including the trailing NUL).
+ *
+ *             **-E2BIG** if the buffer wasn't big enough (*buf* will contain
+ *             truncated name in this case).
+ *
+ *             **-EINVAL** if sysctl is being read.
+ *
+ * int bpf_sysctl_set_new_value(struct bpf_sysctl *ctx, const char *buf, size_t buf_len)
+ *     Description
+ *             Override new value being written by user space to sysctl with
+ *             value provided by program in buffer *buf* of size *buf_len*.
+ *
+ *             *buf* should contain a string in same form as provided by user
+ *             space on sysctl write.
+ *
+ *             User space may write new value at file position > 0. To override
+ *             the whole sysctl value file position should be set to zero.
+ *     Return
+ *             0 on success.
+ *
+ *             **-E2BIG** if the *buf_len* is too big.
+ *
+ *             **-EINVAL** if sysctl is being read.
+ *
+ * int bpf_strtol(const char *buf, size_t buf_len, u64 flags, long *res)
+ *     Description
+ *             Convert the initial part of the string from buffer *buf* of
+ *             size *buf_len* to a long integer according to the given base
+ *             and save the result in *res*.
+ *
+ *             The string may begin with an arbitrary amount of white space
+ *             (as determined by isspace(3)) followed by a single optional '-'
+ *             sign.
+ *
+ *             Five least significant bits of *flags* encode base, other bits
+ *             are currently unused.
+ *
+ *             Base must be either 8, 10, 16 or 0 to detect it automatically
+ *             similar to user space strtol(3).
+ *     Return
+ *             Number of characters consumed on success. Must be positive but
+ *             no more than buf_len.
+ *
+ *             **-EINVAL** if no valid digits were found or unsupported base
+ *             was provided.
+ *
+ *             **-ERANGE** if resulting value was out of range.
+ *
+ * int bpf_strtoul(const char *buf, size_t buf_len, u64 flags, unsigned long *res)
+ *     Description
+ *             Convert the initial part of the string from buffer *buf* of
+ *             size *buf_len* to an unsigned long integer according to the
+ *             given base and save the result in *res*.
+ *
+ *             The string may begin with an arbitrary amount of white space
+ *             (as determined by isspace(3)).
+ *
+ *             Five least significant bits of *flags* encode base, other bits
+ *             are currently unused.
+ *
+ *             Base must be either 8, 10, 16 or 0 to detect it automatically
+ *             similar to user space strtoul(3).
+ *     Return
+ *             Number of characters consumed on success. Must be positive but
+ *             no more than buf_len.
+ *
+ *             **-EINVAL** if no valid digits were found or unsupported base
+ *             was provided.
+ *
+ *             **-ERANGE** if resulting value was out of range.
  */
 #define __BPF_FUNC_MAPPER(FN)          \
        FN(unspec),                     \
@@ -2606,7 +2731,13 @@ union bpf_attr {
        FN(skb_ecn_set_ce),             \
        FN(get_listener_sock),          \
        FN(skc_lookup_tcp),             \
-       FN(tcp_check_syncookie),
+       FN(tcp_check_syncookie),        \
+       FN(sysctl_get_name),            \
+       FN(sysctl_get_current_value),   \
+       FN(sysctl_get_new_value),       \
+       FN(sysctl_set_new_value),       \
+       FN(strtol),                     \
+       FN(strtoul),
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
  * function eBPF program intends to call
@@ -2668,17 +2799,20 @@ enum bpf_func_id {
 /* BPF_FUNC_skb_adjust_room flags. */
 #define BPF_F_ADJ_ROOM_FIXED_GSO       (1ULL << 0)
 
-#define        BPF_ADJ_ROOM_ENCAP_L2_MASK      0xff
-#define        BPF_ADJ_ROOM_ENCAP_L2_SHIFT     56
+#define BPF_ADJ_ROOM_ENCAP_L2_MASK     0xff
+#define BPF_ADJ_ROOM_ENCAP_L2_SHIFT    56
 
 #define BPF_F_ADJ_ROOM_ENCAP_L3_IPV4   (1ULL << 1)
 #define BPF_F_ADJ_ROOM_ENCAP_L3_IPV6   (1ULL << 2)
 #define BPF_F_ADJ_ROOM_ENCAP_L4_GRE    (1ULL << 3)
 #define BPF_F_ADJ_ROOM_ENCAP_L4_UDP    (1ULL << 4)
-#define        BPF_F_ADJ_ROOM_ENCAP_L2(len)    (((__u64)len & \
+#define BPF_F_ADJ_ROOM_ENCAP_L2(len)   (((__u64)len & \
                                          BPF_ADJ_ROOM_ENCAP_L2_MASK) \
                                         << BPF_ADJ_ROOM_ENCAP_L2_SHIFT)
 
+/* BPF_FUNC_sysctl_get_name flags. */
+#define BPF_F_SYSCTL_BASE_NAME         (1ULL << 0)
+
 /* Mode for BPF_FUNC_skb_adjust_room helper. */
 enum bpf_adj_room_mode {
        BPF_ADJ_ROOM_NET,
@@ -3308,4 +3442,14 @@ struct bpf_line_info {
 struct bpf_spin_lock {
        __u32   val;
 };
+
+struct bpf_sysctl {
+       __u32   write;          /* Sysctl is being read (= 0) or written (= 1).
+                                * Allows 1,2,4-byte read, but no write.
+                                */
+       __u32   file_pos;       /* Sysctl file position to read from, write to.
+                                * Allows 1,2,4-byte read an 4-byte write.
+                                */
+};
+
 #endif /* __LINUX_BPF_H__ */
index cf8d5d471c05e1c97a20f4b5f7d5905dbb41e348..1dc7cc6780ac4416ed8dc9a2f00f6d3c9b3185c2 100644 (file)
@@ -90,6 +90,8 @@ struct icmp6hdr {
 #define ICMPV6_TIME_EXCEED             3
 #define ICMPV6_PARAMPROB               4
 
+#define ICMPV6_ERRMSG_MAX       127
+
 #define ICMPV6_INFOMSG_MASK            0x80
 
 #define ICMPV6_ECHO_REQUEST            128
@@ -110,6 +112,8 @@ struct icmp6hdr {
 
 #define ICMPV6_MRDISC_ADV              151
 
+#define ICMPV6_MSG_MAX          255
+
 /*
  *     Codes for Destination Unreachable
  */
index 18a15dad5547b6c33a95d9c7197cf674512197ca..04bca79d29279420f819d09ce2a66ff77e66fea5 100644 (file)
@@ -32,10 +32,11 @@ enum vlan_ioctl_cmds {
 };
 
 enum vlan_flags {
-       VLAN_FLAG_REORDER_HDR   = 0x1,
-       VLAN_FLAG_GVRP          = 0x2,
-       VLAN_FLAG_LOOSE_BINDING = 0x4,
-       VLAN_FLAG_MVRP          = 0x8,
+       VLAN_FLAG_REORDER_HDR           = 0x1,
+       VLAN_FLAG_GVRP                  = 0x2,
+       VLAN_FLAG_LOOSE_BINDING         = 0x4,
+       VLAN_FLAG_MVRP                  = 0x8,
+       VLAN_FLAG_BRIDGE_BINDING        = 0x10,
 };
 
 enum vlan_name_types {
index d393e9ed396426125152a0583a6837274e111e0f..7d1bccbbef781f2c0064b568ee22dba135b5b87e 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef _LINUX_SOCKIOS_H
 #define _LINUX_SOCKIOS_H
 
+#include <asm/bitsperlong.h>
 #include <asm/sockios.h>
 
 /* Linux-specific socket ioctls */
 
 #define SOCK_IOC_TYPE  0x89
 
+/*
+ * the timeval/timespec data structure layout is defined by libc,
+ * so we need to cover both possible versions on 32-bit.
+ */
+/* Get stamp (timeval) */
+#define SIOCGSTAMP_NEW  _IOR(SOCK_IOC_TYPE, 0x06, long long[2])
+/* Get stamp (timespec) */
+#define SIOCGSTAMPNS_NEW _IOR(SOCK_IOC_TYPE, 0x07, long long[2])
+
+#if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__))
+/* on 64-bit and x32, avoid the ?: operator */
+#define SIOCGSTAMP     SIOCGSTAMP_OLD
+#define SIOCGSTAMPNS   SIOCGSTAMPNS_OLD
+#else
+#define SIOCGSTAMP     ((sizeof(struct timeval))  == 8 ? \
+                        SIOCGSTAMP_OLD   : SIOCGSTAMP_NEW)
+#define SIOCGSTAMPNS   ((sizeof(struct timespec)) == 8 ? \
+                        SIOCGSTAMPNS_OLD : SIOCGSTAMPNS_NEW)
+#endif
+
 /* Routing table calls. */
 #define SIOCADDRT      0x890B          /* add routing table entry      */
 #define SIOCDELRT      0x890C          /* delete routing table entry   */
index 7a166a0f9380283ab8009ba3b78e8b09ff6d0afd..e16cb4e2af5871d457e2a56f37838c6654661057 100644 (file)
@@ -190,6 +190,7 @@ struct sockaddr_tipc {
 #define TIPC_MCAST_REPLICAST    134     /* Default: TIPC selects. No arg */
 #define TIPC_GROUP_JOIN         135     /* Takes struct tipc_group_req* */
 #define TIPC_GROUP_LEAVE        136     /* No argument */
+#define TIPC_SOCK_RECVQ_USED    137     /* Default: none (read only) */
 
 /*
  * Flag values