diff options
Diffstat (limited to 'include')
144 files changed, 1157 insertions, 1085 deletions
diff --git a/include/linux-private/linux/if_bridge.h b/include/linux-private/linux/if_bridge.h index bdfecf94..e206aa8f 100644 --- a/include/linux-private/linux/if_bridge.h +++ b/include/linux-private/linux/if_bridge.h @@ -243,6 +243,7 @@ struct br_mdb_entry { union { __be32 ip4; struct in6_addr ip6; + unsigned char mac_addr[ETH_ALEN]; } u; __be16 proto; } addr; diff --git a/include/linux-private/linux/if_link.h b/include/linux-private/linux/if_link.h index f4a97151..47ccf7f6 100644 --- a/include/linux-private/linux/if_link.h +++ b/include/linux-private/linux/if_link.h @@ -455,6 +455,7 @@ enum { IFLA_MACSEC_REPLAY_PROTECT, IFLA_MACSEC_VALIDATION, IFLA_MACSEC_PAD, + IFLA_MACSEC_OFFLOAD, __IFLA_MACSEC_MAX, }; diff --git a/include/linux-private/linux/if_vlan.h b/include/linux-private/linux/if_vlan.h index 18a15dad..04bca79d 100644 --- a/include/linux-private/linux/if_vlan.h +++ b/include/linux-private/linux/if_vlan.h @@ -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 { diff --git a/include/linux-private/linux/netfilter/nfnetlink_log.h b/include/linux-private/linux/netfilter/nfnetlink_log.h index 20983cb1..45c8d3b0 100644 --- a/include/linux-private/linux/netfilter/nfnetlink_log.h +++ b/include/linux-private/linux/netfilter/nfnetlink_log.h @@ -33,6 +33,15 @@ struct nfulnl_msg_packet_timestamp { __aligned_be64 usec; }; +enum nfulnl_vlan_attr { + NFULA_VLAN_UNSPEC, + NFULA_VLAN_PROTO, /* __be16 skb vlan_proto */ + NFULA_VLAN_TCI, /* __be16 skb htons(vlan_tci) */ + __NFULA_VLAN_MAX, +}; + +#define NFULA_VLAN_MAX (__NFULA_VLAN_MAX + 1) + enum nfulnl_attr_type { NFULA_UNSPEC, NFULA_PACKET_HDR, @@ -54,6 +63,8 @@ enum nfulnl_attr_type { NFULA_HWLEN, /* hardware header length */ NFULA_CT, /* nf_conntrack_netlink.h */ NFULA_CT_INFO, /* enum ip_conntrack_info */ + NFULA_VLAN, /* nested attribute: packet vlan info */ + NFULA_L2HDR, /* full L2 header */ __NFULA_MAX }; diff --git a/include/linux-private/linux/tc_act/tc_nat.h b/include/linux-private/linux/tc_act/tc_nat.h new file mode 100644 index 00000000..21399c2c --- /dev/null +++ b/include/linux-private/linux/tc_act/tc_nat.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __LINUX_TC_NAT_H +#define __LINUX_TC_NAT_H + +#include <linux/pkt_cls.h> +#include <linux/types.h> + +enum { + TCA_NAT_UNSPEC, + TCA_NAT_PARMS, + TCA_NAT_TM, + TCA_NAT_PAD, + __TCA_NAT_MAX +}; +#define TCA_NAT_MAX (__TCA_NAT_MAX - 1) + +#define TCA_NAT_FLAG_EGRESS 1 + +struct tc_nat { + tc_gen; + __be32 old_addr; + __be32 new_addr; + __be32 mask; + __u32 flags; +}; + +#endif diff --git a/include/netlink-private/cache-api.h b/include/netlink-private/cache-api.h index c684e797..38662b71 100644 --- a/include/netlink-private/cache-api.h +++ b/include/netlink-private/cache-api.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink-private/cache-api.h Caching API - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink-private/genl.h b/include/netlink-private/genl.h index 5b93db3c..ac592bd8 100644 --- a/include/netlink-private/genl.h +++ b/include/netlink-private/genl.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink-private/genl.h Local Generic Netlink Interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink-private/netlink.h b/include/netlink-private/netlink.h index 5f6e3f79..d86a55d9 100644 --- a/include/netlink-private/netlink.h +++ b/include/netlink-private/netlink.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink-private/netlink.h Local Netlink Interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ @@ -65,6 +59,7 @@ #include <netlink-private/object-api.h> #include <netlink-private/cache-api.h> #include <netlink-private/types.h> +#include <netlink-private/utils.h> #define NSEC_PER_SEC 1000000000L diff --git a/include/netlink-private/nl-auto.h b/include/netlink-private/nl-auto.h new file mode 100644 index 00000000..4092782b --- /dev/null +++ b/include/netlink-private/nl-auto.h @@ -0,0 +1,102 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ + +#ifndef NETLINK_NL_AUTO_H_ +#define NETLINK_NL_AUTO_H_ + +#include <stdlib.h> + +#define _nl_auto(fcn) __attribute__ ((__cleanup__(fcn))) + +#define _NL_AUTO_DEFINE_FCN_VOID0(CastType, name, func) \ +static inline void name(void *v) \ +{ \ + if (*((CastType *) v)) \ + func(*((CastType *) v)); \ +} \ +struct _nl_dummy_for_tailing_semicolon + +#define _NL_AUTO_DEFINE_FCN_STRUCT(CastType, name, func) \ +static inline void name(CastType *v) \ +{ \ + if (v) \ + func(v); \ +} \ +struct _nl_dummy_for_tailing_semicolon + +#define _NL_AUTO_DEFINE_FCN_TYPED0(CastType, name, func) \ +static inline void name(CastType *v) \ +{ \ + if (*v) \ + func(*v); \ +} \ +struct _nl_dummy_for_tailing_semicolon + +#define _nl_auto_free _nl_auto(_nl_auto_free_fcn) +_NL_AUTO_DEFINE_FCN_VOID0(void *, _nl_auto_free_fcn, free); + +struct nl_addr; +void nl_addr_put(struct nl_addr *); +#define _nl_auto_nl_addr _nl_auto(_nl_auto_nl_addr_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct nl_addr *, _nl_auto_nl_addr_fcn, nl_addr_put); + +struct nl_data; +void nl_data_free(struct nl_data *data); +#define _nl_auto_nl_data _nl_auto(_nl_auto_nl_data_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct nl_data *, _nl_auto_nl_data_fcn, nl_data_free); + +struct nl_msg; +void nlmsg_free(struct nl_msg *); +#define _nl_auto_nl_msg _nl_auto(_nl_auto_nl_msg_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct nl_msg *, _nl_auto_nl_msg_fcn, nlmsg_free); + +struct rtnl_link; +void rtnl_link_put(struct rtnl_link *); +#define _nl_auto_rtnl_link _nl_auto(_nl_auto_rtnl_link_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct rtnl_link *, _nl_auto_rtnl_link_fcn, rtnl_link_put); + +struct rtnl_route; +void rtnl_route_put(struct rtnl_route *); +#define _nl_auto_rtnl_route _nl_auto(_nl_auto_rtnl_route_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct rtnl_route *, _nl_auto_rtnl_route_fcn, rtnl_route_put); + +struct rtnl_mdb; +void rtnl_mdb_put(struct rtnl_mdb *); +#define _nl_auto_rtnl_mdb _nl_auto(_nl_auto_rtnl_mdb_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct rtnl_mdb *, _nl_auto_rtnl_mdb_fcn, rtnl_mdb_put); + +struct rtnl_nexthop; +void rtnl_route_nh_free(struct rtnl_nexthop *); +#define _nl_auto_rtnl_nexthop _nl_auto(_nl_auto_rtnl_nexthop_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct rtnl_nexthop *, _nl_auto_rtnl_nexthop_fcn, rtnl_route_nh_free); + +struct nl_cache; +void nl_cache_put(struct nl_cache *); +#define _nl_auto_nl_cache _nl_auto(_nl_auto_nl_cache_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct nl_cache *, _nl_auto_nl_cache_fcn, nl_cache_put); + +struct rtnl_link_af_ops; +void rtnl_link_af_ops_put(struct rtnl_link_af_ops *); +#define _nl_auto_rtnl_link_af_ops _nl_auto(_nl_auto_rtnl_link_af_ops_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct rtnl_link_af_ops *, _nl_auto_rtnl_link_af_ops_fcn, rtnl_link_af_ops_put); + +struct rtnl_act; +void rtnl_act_put(struct rtnl_act *); +#define _nl_auto_rtnl_act _nl_auto(_nl_auto_rtnl_act_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct rtnl_act *, _nl_auto_rtnl_act_fcn, rtnl_act_put); + +struct rtnl_ematch_tree; +void rtnl_ematch_tree_free(struct rtnl_ematch_tree *); +#define _nl_auto_rtnl_ematch_tree _nl_auto(_nl_auto_rtnl_ematch_tree_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct rtnl_ematch_tree *, _nl_auto_rtnl_ematch_tree_fcn, rtnl_ematch_tree_free); + +struct rtnl_cls; +void rtnl_cls_put(struct rtnl_cls *); +#define _nl_auto_rtnl_cls _nl_auto(_nl_auto_rtnl_cls_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct rtnl_cls *, _nl_auto_rtnl_cls_fcn, rtnl_cls_put); + +struct nl_sock; +void nl_socket_free(struct nl_sock *); +#define _nl_auto_nl_socket _nl_auto(_nl_auto_nl_socket_fcn) +_NL_AUTO_DEFINE_FCN_TYPED0(struct nl_sock *, _nl_auto_nl_socket_fcn, nl_socket_free); + +#endif /* NETLINK_NL_AUTO_H_ */ diff --git a/include/netlink-private/object-api.h b/include/netlink-private/object-api.h index 517e6720..a2838fd4 100644 --- a/include/netlink-private/object-api.h +++ b/include/netlink-private/object-api.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink-private/object-api.c Object API - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink-private/route/link/api.h b/include/netlink-private/route/link/api.h index 6d30bf7c..189f3615 100644 --- a/include/netlink-private/route/link/api.h +++ b/include/netlink-private/route/link/api.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink-private/route/link/api.h Link Modules API - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ @@ -68,6 +62,7 @@ struct rtnl_link_info_ops }; extern struct rtnl_link_info_ops *rtnl_link_info_ops_lookup(const char *); +extern void rtnl_link_info_ops_get(struct rtnl_link_info_ops *); extern void rtnl_link_info_ops_put(struct rtnl_link_info_ops *); extern int rtnl_link_register_info(struct rtnl_link_info_ops *); extern int rtnl_link_unregister_info(struct rtnl_link_info_ops *); diff --git a/include/netlink-private/route/link/sriov.h b/include/netlink-private/route/link/sriov.h index ac653ed1..f7c027a7 100644 --- a/include/netlink-private/route/link/sriov.h +++ b/include/netlink-private/route/link/sriov.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * include/netlink-private/route/link/sriov.h SRIOV VF Info - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2016 Intel Corp. All rights reserved. * Copyright (c) 2016 Jef Oliver <jef.oliver@intel.com> */ diff --git a/include/netlink-private/route/tc-api.h b/include/netlink-private/route/tc-api.h index 7158ce5c..1eb27dca 100644 --- a/include/netlink-private/route/tc-api.h +++ b/include/netlink-private/route/tc-api.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink-private/route/tc-api.h Traffic Control API - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2011-2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink-private/route/utils.h b/include/netlink-private/route/utils.h new file mode 100644 index 00000000..65ff5312 --- /dev/null +++ b/include/netlink-private/route/utils.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ + +#ifndef NETLINK_ROUTE_UTILS_PRIV_H_ +#define NETLINK_ROUTE_UTILS_PRIV_H_ + +extern const uint8_t *const _nltst_map_stat_id_from_IPSTATS_MIB_v2; + +#endif diff --git a/include/netlink-private/socket.h b/include/netlink-private/socket.h index 9ceecfd1..5fe77fa5 100644 --- a/include/netlink-private/socket.h +++ b/include/netlink-private/socket.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink-private/socket.h Private declarations for socket - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2014 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink-private/tc.h b/include/netlink-private/tc.h index b0f9c506..5f5d1ffb 100644 --- a/include/netlink-private/tc.h +++ b/include/netlink-private/tc.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink-private/tc.h Local Traffic Control Interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink-private/types.h b/include/netlink-private/types.h index 97af3e51..b8f785af 100644 --- a/include/netlink-private/types.h +++ b/include/netlink-private/types.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink-private/types.h Netlink Types (Private) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> * Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com> */ @@ -33,6 +27,9 @@ #include <linux/tc_act/tc_vlan.h> #include <linux/sock_diag.h> #include <linux/fib_rules.h> +#include <linux/if_ether.h> + +#include <netinet/in.h> #define NL_SOCK_PASSCRED (1<<1) #define NL_OWN_PORT (1<<2) @@ -616,6 +613,27 @@ struct rtnl_mall int m_mask; }; +struct rtnl_flower +{ + struct rtnl_act *cf_act; + int cf_mask; + uint32_t cf_flags; + uint16_t cf_proto; + uint16_t cf_vlan_id; + uint16_t cf_vlan_ethtype; + uint8_t cf_vlan_prio; + uint8_t cf_src_mac[ETH_ALEN]; + uint8_t cf_src_mac_mask[ETH_ALEN]; + uint8_t cf_dst_mac[ETH_ALEN]; + uint8_t cf_dst_mac_mask[ETH_ALEN]; + in_addr_t cf_ipv4_src; + in_addr_t cf_ipv4_src_mask; + in_addr_t cf_ipv4_dst; + in_addr_t cf_ipv4_dst_mask; + uint8_t cf_ip_dscp; + uint8_t cf_ip_dscp_mask; +}; + struct rtnl_cgroup { struct rtnl_ematch_tree *cg_ematch; @@ -1015,6 +1033,14 @@ struct nfnl_log_msg { uint32_t log_msg_gid; uint32_t log_msg_seq; uint32_t log_msg_seq_global; + uint16_t log_msg_hwtype; + uint16_t log_msg_hwlen; + void * log_msg_hwheader; + int log_msg_hwheader_len; + uint16_t log_msg_vlan_tag; + uint16_t log_msg_vlan_proto; + uint32_t log_msg_ct_info; + struct nfnl_ct * log_msg_ct; }; struct nfnl_queue { @@ -1237,6 +1263,11 @@ struct xfrmnl_encap_tmpl { struct nl_addr* encap_oa; }; +struct xfrmnl_user_offload { + int ifindex; + uint8_t flags; +}; + struct xfrmnl_sa { NLHDR_COMMON @@ -1266,6 +1297,7 @@ struct xfrmnl_sa { struct xfrmnl_replay_state replay_state; struct xfrmnl_replay_state_esn* replay_state_esn; uint8_t hard; + struct xfrmnl_user_offload* user_offload; }; struct xfrmnl_usersa_flush { @@ -1338,4 +1370,19 @@ struct rtnl_vlan uint32_t v_flags; }; +struct rtnl_mdb { + NLHDR_COMMON + uint32_t ifindex; + + struct nl_list_head mdb_entry_list; +}; + +struct rtnl_mdb_entry { + struct nl_list_head mdb_list; + struct nl_addr *addr; + uint32_t ifindex; + uint16_t vid; + uint16_t proto; + uint8_t state; +}; #endif diff --git a/include/netlink-private/utils.h b/include/netlink-private/utils.h index f33a2f84..93a04c94 100644 --- a/include/netlink-private/utils.h +++ b/include/netlink-private/utils.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink-private/utils.h Local Utility Functions - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> */ @@ -13,6 +7,13 @@ #define NETLINK_UTILS_PRIV_H_ #include <byteswap.h> +#include <assert.h> +#include <unistd.h> +#include <errno.h> +#include <string.h> +#include <stdbool.h> +#include <netinet/in.h> +#include <arpa/inet.h> #if __BYTE_ORDER == __BIG_ENDIAN #define ntohll(x) (x) @@ -71,6 +72,23 @@ /*****************************************************************************/ +#ifdef thread_local +#define _nl_thread_local thread_local +/* + * Don't break on glibc < 2.16 that doesn't define __STDC_NO_THREADS__ + * see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769 + */ +#elif __STDC_VERSION__ >= 201112L && \ + !(defined(__STDC_NO_THREADS__) || \ + (defined(__GNU_LIBRARY__) && __GLIBC__ == 2 && \ + __GLIBC_MINOR__ < 16)) +#define _nl_thread_local _Thread_local +#else +#define _nl_thread_local __thread +#endif + +/*****************************************************************************/ + #define _NL_STATIC_ASSERT(cond) ((void) sizeof (char[(cond) ? 1 : -1])) /*****************************************************************************/ @@ -81,17 +99,45 @@ #define _nl_assert(cond) do { if (0) { assert(cond); } } while (0) #endif +#define _nl_assert_not_reached() assert(0) + /*****************************************************************************/ -#define _NL_AUTO_DEFINE_FCN_VOID0(CastType, name, func) \ -static inline void name (void *v) \ -{ \ - if (*((CastType *) v)) \ - func (*((CastType *) v)); \ -} +#define _nl_assert_addr_family_or_unspec(addr_family) \ + do { \ + typeof(addr_family) _addr_family = (addr_family); \ + \ + _nl_assert(_addr_family == AF_UNSPEC || \ + _addr_family == AF_INET || \ + _addr_family == AF_INET6); \ + } while (0) + +#define _nl_assert_addr_family(addr_family) \ + do { \ + typeof(addr_family) _addr_family = (addr_family); \ + \ + _nl_assert(_addr_family == AF_INET || \ + _addr_family == AF_INET6); \ + } while (0) + +/*****************************************************************************/ + +#define _NL_SWAP(pa, pb) \ + do { \ + typeof(*(pa)) *_pa = (pa); \ + typeof(*(pb)) *_pb = (pb); \ + typeof(*_pa) _tmp; \ + \ + _nl_assert(_pa); \ + _nl_assert(_pb); \ + _tmp = *_pa; \ + *_pa = *_pb; \ + *_pb = _tmp; \ + } while (0) + +/*****************************************************************************/ -#define _nl_auto_free _nl_auto(_nl_auto_free_fcn) -_NL_AUTO_DEFINE_FCN_VOID0 (void *, _nl_auto_free_fcn, free) +#define _NL_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) /*****************************************************************************/ @@ -163,11 +209,21 @@ extern const char *nl_strerror_l(int err); /*****************************************************************************/ +static inline bool _nl_streq(const char *a, const char *b) +{ + return !strcmp(a, b); +} + +static inline bool _nl_streq0(const char *a, const char *b) +{ + return a == b || (a && b && _nl_streq(a, b)); +} + static inline char * _nl_strncpy_trunc(char *dst, const char *src, size_t len) { /* we don't use/reimplement strlcpy(), because we want the fill-all-with-NUL - * behavior of strncpy(). This is just strncpy() with gracefully handling trunction + * behavior of strncpy(). This is just strncpy() with gracefully handling truncation * (and disabling the "-Wstringop-truncation" warning). * * Note that truncation is silently accepted. @@ -192,32 +248,146 @@ _nl_strncpy_trunc(char *dst, const char *src, size_t len) } static inline char * -_nl_strncpy(char *dst, const char *src, size_t len) +_nl_strncpy_assert(char *dst, const char *src, size_t len) { /* we don't use/reimplement strlcpy(), because we want the fill-all-with-NUL - * behavior of strncpy(). This is just strncpy() with gracefully handling trunction + * behavior of strncpy(). This is just strncpy() with assertion against truncation * (and disabling the "-Wstringop-truncation" warning). * * Note that truncation is still a bug and there is an _nl_assert() * against that. */ + _NL_PRAGMA_WARNING_DISABLE ("-Wstringop-truncation"); + _NL_PRAGMA_WARNING_DISABLE ("-Wstringop-overflow"); + if (len > 0) { _nl_assert(dst); _nl_assert(src); strncpy(dst, src, len); - /* Truncation is a bug and we assert against it. But note that this - * assertion is disabled by default because we cannot be sure that - * there are not wrong uses of _nl_strncpy() where truncation might - * happen (wrongly!!). */ - _nl_assert (memchr(dst, '\0', len)); + _nl_assert (dst[len - 1] == '\0'); dst[len - 1] = '\0'; } + _NL_PRAGMA_WARNING_REENABLE; + _NL_PRAGMA_WARNING_REENABLE; + return dst; } +#include "nl-auto.h" + +#define _NL_RETURN_ON_ERR(cmd) \ + do { \ + int _err; \ + \ + _err = (cmd); \ + if (_err < 0) \ + return _err; \ + } while (0) + +#define _NL_RETURN_E_ON_ERR(e, cmd) \ + do { \ + int _err; \ + \ + _err = (cmd); \ + if (_err < 0) { \ + _NL_STATIC_ASSERT((e) > 0); \ + return -(e); \ + } \ + } while (0) + +/* _NL_RETURN_ON_PUT_ERR() shall only be used with a put command (nla_put or nlmsg_append). + * These commands can either fail with a regular error code (which gets propagated) + * or with -NLE_NOMEM. However, they don't really try to allocate memory, so we don't + * want to propagate -NLE_NOMEM. Instead, we coerce such failure to -NLE_MSGSIZE. */ +#define _NL_RETURN_ON_PUT_ERR(put_cmd) \ + do { \ + int _err; \ + \ + _err = (put_cmd); \ + if (_err < 0) { \ + if (_err == -NLE_NOMEM) { \ + /* nla_put() returns -NLE_NOMEM in case of out of buffer size. We don't + * want to propagate that error and map it to -NLE_MSGSIZE. */ \ + return -NLE_MSGSIZE; \ + } \ + /* any other error can only be due to invalid parameters. Propagate the + * error, however also assert that it cannot be reached. */ \ + _nl_assert_not_reached (); \ + return _err; \ + } else \ + _nl_assert (_err == 0); \ + } while (0) + +static inline int +_nl_close(int fd) +{ + int r; + + r = close(fd); + _nl_assert(r == 0 || fd < 0 || errno != EBADF); + return r; +} + +static inline void * +_nl_memdup(const void *ptr, size_t len) +{ + void *p; + + if (len == 0) { + /* malloc() leaves it implementation defined whether to return NULL. + * Callers rely on returning NULL if len is zero. */ + return NULL; + } + + p = malloc(len); + if (!p) + return NULL; + memcpy(p, ptr, len); + return p; +} + +#define _nl_memdup_ptr(ptr) ((__typeof__(ptr)) _nl_memdup((ptr), sizeof(*(ptr)))) + +/*****************************************************************************/ + +typedef union { + in_addr_t addr4; + struct in_addr a4; + struct in6_addr a6; +} _NLIPAddr; + +static inline char *_nl_inet_ntop(int addr_family, const void *addr, + char buf[static INET_ADDRSTRLEN]) +{ + char *r; + + _nl_assert_addr_family(addr_family); + _nl_assert(addr); + + /* inet_ntop() is documented to fail, but if we pass a known address family + * and a suitably large buffer, it cannot. Assert for that. */ + + r = (char *)inet_ntop(addr_family, addr, buf, + (addr_family == AF_INET) ? INET_ADDRSTRLEN : + INET6_ADDRSTRLEN); + _nl_assert(r == buf); + _nl_assert(strlen(r) < ((addr_family == AF_INET) ? INET_ADDRSTRLEN : + INET6_ADDRSTRLEN)); + + return r; +} + +static inline char *_nl_inet_ntop_dup(int addr_family, const void *addr) +{ + return (char *)_nl_inet_ntop(addr_family, addr, + malloc((addr_family == AF_INET) ? + INET_ADDRSTRLEN : + INET6_ADDRSTRLEN)); +} + #endif diff --git a/include/netlink/.gitignore b/include/netlink/.gitignore deleted file mode 100644 index 67020331..00000000 --- a/include/netlink/.gitignore +++ /dev/null @@ -1 +0,0 @@ -version.h diff --git a/include/netlink/addr.h b/include/netlink/addr.h index 00ca7846..851e9403 100644 --- a/include/netlink/addr.h +++ b/include/netlink/addr.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/addr.h Abstract Address - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/attr.h b/include/netlink/attr.h index e47aa5d5..2cd32ee1 100644 --- a/include/netlink/attr.h +++ b/include/netlink/attr.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/attr.h Netlink Attributes - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/cache-api.h b/include/netlink/cache-api.h index e43c7ca0..851eca0b 100644 --- a/include/netlink/cache-api.h +++ b/include/netlink/cache-api.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cache-api.h Caching API - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/cache.h b/include/netlink/cache.h index c0797d01..abeeccbd 100644 --- a/include/netlink/cache.h +++ b/include/netlink/cache.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cache.h Caching Module - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/cli/addr.h b/include/netlink/cli/addr.h index d0fd0551..5fcf7347 100644 --- a/include/netlink/cli/addr.h +++ b/include/netlink/cli/addr.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cli/addr.h CLI Address Helpers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch> */ @@ -14,6 +8,10 @@ #include <netlink/route/addr.h> +#ifdef __cplusplus +extern "C" { +#endif + #define nl_cli_addr_alloc_cache(sk) \ nl_cli_alloc_cache((sk), "address", rtnl_addr_alloc_cache) @@ -29,4 +27,8 @@ extern void nl_cli_addr_parse_broadcast(struct rtnl_addr *, char *); extern void nl_cli_addr_parse_preferred(struct rtnl_addr *, char *); extern void nl_cli_addr_parse_valid(struct rtnl_addr *, char *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/netlink/cli/class.h b/include/netlink/cli/class.h index 5001e428..95523740 100644 --- a/include/netlink/cli/class.h +++ b/include/netlink/cli/class.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cli/class.h CLI Class Helpers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> */ @@ -15,7 +9,15 @@ #include <netlink/route/class.h> #include <netlink/cli/tc.h> +#ifdef __cplusplus +extern "C" { +#endif + extern struct rtnl_class *nl_cli_class_alloc(void); extern struct nl_cache *nl_cli_class_alloc_cache(struct nl_sock *, int); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/netlink/cli/cls.h b/include/netlink/cli/cls.h index a2707b8e..602b1982 100644 --- a/include/netlink/cli/cls.h +++ b/include/netlink/cli/cls.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cli/cls.h CLI Classifier Helpers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> */ @@ -15,10 +9,18 @@ #include <netlink/route/classifier.h> #include <netlink/cli/tc.h> +#ifdef __cplusplus +extern "C" { +#endif + extern struct rtnl_cls * nl_cli_cls_alloc(void); extern struct nl_cache * nl_cli_cls_alloc_cache(struct nl_sock *, int, uint32_t); extern void nl_cli_cls_parse_proto(struct rtnl_cls *, char *); extern struct rtnl_ematch_tree *nl_cli_cls_parse_ematch(struct rtnl_cls *, char *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/netlink/cli/ct.h b/include/netlink/cli/ct.h index ebe7c9dc..a50b430f 100644 --- a/include/netlink/cli/ct.h +++ b/include/netlink/cli/ct.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cli/ct.h CLI Conntrack Helper - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch> */ @@ -15,6 +9,10 @@ #include <netlink/netfilter/ct.h> #include <linux/netfilter/nf_conntrack_common.h> +#ifdef __cplusplus +extern "C" { +#endif + extern struct nfnl_ct *nl_cli_ct_alloc(void); extern struct nl_cache *nl_cli_ct_alloc_cache(struct nl_sock *); @@ -32,4 +30,8 @@ extern void nl_cli_ct_parse_tcp_state(struct nfnl_ct *, char *); extern void nl_cli_ct_parse_status(struct nfnl_ct *, char *); extern void nl_cli_ct_parse_zone(struct nfnl_ct *, char *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/netlink/cli/exp.h b/include/netlink/cli/exp.h index b2418f8d..64d3b089 100644 --- a/include/netlink/cli/exp.h +++ b/include/netlink/cli/exp.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cli/exp.h CLI Expectation Helper - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2012 Rich Fought <Rich.Fought@watchguard.com> * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch> */ @@ -16,6 +10,10 @@ #include <netlink/netfilter/exp.h> #include <linux/netfilter/nf_conntrack_common.h> +#ifdef __cplusplus +extern "C" { +#endif + extern struct nfnl_exp *nl_cli_exp_alloc(void); extern struct nl_cache *nl_cli_exp_alloc_cache(struct nl_sock *); @@ -38,5 +36,8 @@ extern void nl_cli_exp_parse_icmp_id(struct nfnl_exp *, int, char *); extern void nl_cli_exp_parse_icmp_type(struct nfnl_exp *, int, char *); extern void nl_cli_exp_parse_icmp_code(struct nfnl_exp *, int, char *); +#ifdef __cplusplus +} +#endif #endif diff --git a/include/netlink/cli/link.h b/include/netlink/cli/link.h index f2c720ba..fb6c0a43 100644 --- a/include/netlink/cli/link.h +++ b/include/netlink/cli/link.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cli/link.h CLI Link Helpers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch> */ @@ -15,6 +9,10 @@ #include <netlink/route/link.h> #include <netlink/cli/utils.h> +#ifdef __cplusplus +extern "C" { +#endif + extern struct rtnl_link *nl_cli_link_alloc(void); extern struct nl_cache *nl_cli_link_alloc_cache_family(struct nl_sock *, int); extern struct nl_cache *nl_cli_link_alloc_cache_family_flags(struct nl_sock *, int, @@ -31,4 +29,8 @@ extern void nl_cli_link_parse_txqlen(struct rtnl_link *, char *); extern void nl_cli_link_parse_weight(struct rtnl_link *, char *); extern void nl_cli_link_parse_ifalias(struct rtnl_link *, char *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/netlink/cli/mdb.h b/include/netlink/cli/mdb.h new file mode 100644 index 00000000..cd37604a --- /dev/null +++ b/include/netlink/cli/mdb.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ + +#ifndef __NETLINK_CLI_MDB_H_ +#define __NETLINK_CLI_MDB_H_ + +#include <netlink/route/mdb.h> + +#define nl_cli_mdb_alloc_cache(sk) \ + nl_cli_alloc_cache_flags((sk), "mdb", NL_CACHE_AF_ITER, rtnl_mdb_alloc_cache) + +#endif diff --git a/include/netlink/cli/neigh.h b/include/netlink/cli/neigh.h index 1c1be91b..89a336c0 100644 --- a/include/netlink/cli/neigh.h +++ b/include/netlink/cli/neigh.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cli/neighbour.h CLI Neighbour Helpers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch> */ @@ -14,6 +8,10 @@ #include <netlink/route/neighbour.h> +#ifdef __cplusplus +extern "C" { +#endif + #define nl_cli_neigh_alloc_cache(sk) \ nl_cli_alloc_cache_flags((sk), "neighbour", NL_CACHE_AF_ITER, \ rtnl_neigh_alloc_cache_flags) @@ -25,4 +23,8 @@ extern void nl_cli_neigh_parse_dev(struct rtnl_neigh *, struct nl_cache *, char extern void nl_cli_neigh_parse_family(struct rtnl_neigh *, char *); extern void nl_cli_neigh_parse_state(struct rtnl_neigh *, char *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/netlink/cli/qdisc.h b/include/netlink/cli/qdisc.h index b102da4f..d70e5591 100644 --- a/include/netlink/cli/qdisc.h +++ b/include/netlink/cli/qdisc.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cli/qdisc.h CLI QDisc Helpers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008-2011 Thomas Graf <tgraf@suug.ch> */ @@ -14,10 +8,18 @@ #include <netlink/route/qdisc.h> +#ifdef __cplusplus +extern "C" { +#endif + #define nl_cli_qdisc_alloc_cache(sk) \ nl_cli_alloc_cache((sk), "queueing disciplines", \ rtnl_qdisc_alloc_cache) extern struct rtnl_qdisc *nl_cli_qdisc_alloc(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/netlink/cli/route.h b/include/netlink/cli/route.h index 089c6582..3650d8b4 100644 --- a/include/netlink/cli/route.h +++ b/include/netlink/cli/route.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cli//route.h CLI Route Helpers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch> */ @@ -14,6 +8,10 @@ #include <netlink/route/route.h> +#ifdef __cplusplus +extern "C" { +#endif + extern struct rtnl_route *nl_cli_route_alloc(void); extern struct nl_cache *nl_cli_route_alloc_cache(struct nl_sock *, int); @@ -31,4 +29,8 @@ extern void nl_cli_route_parse_protocol(struct rtnl_route *, char *); extern void nl_cli_route_parse_type(struct rtnl_route *, char *); extern void nl_cli_route_parse_iif(struct rtnl_route *, char *, struct nl_cache *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/netlink/cli/rule.h b/include/netlink/cli/rule.h index 61cd63e3..82bf067a 100644 --- a/include/netlink/cli/rule.h +++ b/include/netlink/cli/rule.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cli/rule.h CLI Routing Rule Helpers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch> */ @@ -14,8 +8,16 @@ #include <netlink/route/rule.h> +#ifdef __cplusplus +extern "C" { +#endif + extern struct rtnl_rule *nl_cli_rule_alloc(void); extern struct nl_cache *nl_cli_rule_alloc_cache(struct nl_sock *); extern void nl_cli_rule_parse_family(struct rtnl_rule *, char *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/netlink/cli/tc.h b/include/netlink/cli/tc.h index 77042c71..7d4ed7a1 100644 --- a/include/netlink/cli/tc.h +++ b/include/netlink/cli/tc.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/cli/tc.h CLI Traffic Control Helpers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2010-2011 Thomas Graf <tgraf@suug.ch> */ @@ -14,6 +8,10 @@ #include <netlink/route/tc.h> +#ifdef __cplusplus +extern "C" { +#endif + struct rtnl_tc_ops; extern void nl_cli_tc_parse_dev(struct rtnl_tc *, struct nl_cache *, char *); @@ -38,4 +36,8 @@ extern struct nl_cli_tc_module *nl_cli_tc_lookup(struct rtnl_tc_ops *); extern void nl_cli_tc_register(struct nl_cli_tc_module *); extern void nl_cli_tc_unregister(struct nl_cli_tc_module *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/netlink/cli/utils.h b/include/netlink/cli/utils.h index 7d69543a..7047d2e0 100644 --- a/include/netlink/cli/utils.h +++ b/include/netlink/cli/utils.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * src/utils.h Utilities - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2009 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/data.h b/include/netlink/data.h index 45010fe6..c9c76a11 100644 --- a/include/netlink/data.h +++ b/include/netlink/data.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/data.h Abstract Data - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/errno.h b/include/netlink/errno.h index 35710cf6..6a5b4de3 100644 --- a/include/netlink/errno.h +++ b/include/netlink/errno.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/errno.h Error Numbers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/fib_lookup/lookup.h b/include/netlink/fib_lookup/lookup.h index b3c7b5f4..81fa435d 100644 --- a/include/netlink/fib_lookup/lookup.h +++ b/include/netlink/fib_lookup/lookup.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/fib_lookup/fib_lookup.h FIB Lookup - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/fib_lookup/request.h b/include/netlink/fib_lookup/request.h index 60e8820f..ed7cdd83 100644 --- a/include/netlink/fib_lookup/request.h +++ b/include/netlink/fib_lookup/request.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/fib_lookup/request.h FIB Lookup Request - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/genl/ctrl.h b/include/netlink/genl/ctrl.h index 017b8fdf..92d60b37 100644 --- a/include/netlink/genl/ctrl.h +++ b/include/netlink/genl/ctrl.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/genl/ctrl.h Generic Netlink Controller - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/genl/family.h b/include/netlink/genl/family.h index 5432b594..2e9f9fd4 100644 --- a/include/netlink/genl/family.h +++ b/include/netlink/genl/family.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/genl/family.h Generic Netlink Family - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/genl/genl.h b/include/netlink/genl/genl.h index c4ac137d..f1e3a658 100644 --- a/include/netlink/genl/genl.h +++ b/include/netlink/genl/genl.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/genl/genl.h Generic Netlink - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/genl/mngt.h b/include/netlink/genl/mngt.h index 8a51ccdd..af9edb3d 100644 --- a/include/netlink/genl/mngt.h +++ b/include/netlink/genl/mngt.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/genl/mngt.h Generic Netlink Management - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/handlers.h b/include/netlink/handlers.h index 4fac1481..2043844f 100644 --- a/include/netlink/handlers.h +++ b/include/netlink/handlers.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/handlers.c default netlink message handlers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> */ @@ -39,7 +33,7 @@ struct nl_msg; * nl_recvmsgs() callback for message processing customization * @ingroup cb * @arg msg netlink message being processed - * @arg arg argument passwd on through caller + * @arg arg argument passed on through caller */ typedef int (*nl_recvmsg_msg_cb_t)(struct nl_msg *msg, void *arg); @@ -60,7 +54,7 @@ typedef int (*nl_recvmsg_err_cb_t)(struct sockaddr_nl *nla, * @ingroup cb */ enum nl_cb_action { - /** Proceed with wathever would come next */ + /** Proceed with whatever would come next */ NL_OK, /** Skip this message */ NL_SKIP, @@ -99,7 +93,7 @@ enum nl_cb_type { NL_CB_OVERRUN, /** Message wants to be skipped */ NL_CB_SKIPPED, - /** Message is an acknowledge */ + /** Message is an acknowledgement */ NL_CB_ACK, /** Called for every message received */ NL_CB_MSG_IN, diff --git a/include/netlink/hashtable.h b/include/netlink/hashtable.h index 3b40d86c..32578dc8 100644 --- a/include/netlink/hashtable.h +++ b/include/netlink/hashtable.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/hashtable.h Netlink hashtable Utilities - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2012 Cumulus Networks, Inc */ diff --git a/include/netlink/idiag/idiagnl.h b/include/netlink/idiag/idiagnl.h index b69cbf17..7385d5f1 100644 --- a/include/netlink/idiag/idiagnl.h +++ b/include/netlink/idiag/idiagnl.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/idiag/idiagnl.h Inetdiag Netlink - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com> */ diff --git a/include/netlink/idiag/meminfo.h b/include/netlink/idiag/meminfo.h index 19223953..8a27647e 100644 --- a/include/netlink/idiag/meminfo.h +++ b/include/netlink/idiag/meminfo.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/idiag/meminfo.h Inetdiag Netlink Memory Info - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com> */ diff --git a/include/netlink/idiag/msg.h b/include/netlink/idiag/msg.h index 01e30db0..f2a79ce0 100644 --- a/include/netlink/idiag/msg.h +++ b/include/netlink/idiag/msg.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/idiag/msg.h Inetdiag Netlink Message - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com> */ diff --git a/include/netlink/idiag/req.h b/include/netlink/idiag/req.h index b63a4ce0..fb75b960 100644 --- a/include/netlink/idiag/req.h +++ b/include/netlink/idiag/req.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/idiag/req.h Inetdiag Netlink Request - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com> */ diff --git a/include/netlink/idiag/vegasinfo.h b/include/netlink/idiag/vegasinfo.h index 792b5c16..890c175b 100644 --- a/include/netlink/idiag/vegasinfo.h +++ b/include/netlink/idiag/vegasinfo.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/idiag/vegasinfo.h Inetdiag Netlink TCP Vegas Info - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com> */ diff --git a/include/netlink/list.h b/include/netlink/list.h index 2f206347..7ab1438f 100644 --- a/include/netlink/list.h +++ b/include/netlink/list.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/list.h Netlink List Utilities - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/msg.h b/include/netlink/msg.h index 51d9aebc..84aaa607 100644 --- a/include/netlink/msg.h +++ b/include/netlink/msg.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/msg.c Netlink Messages Interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/netfilter/ct.h b/include/netlink/netfilter/ct.h index ef5d0355..ddf13732 100644 --- a/include/netlink/netfilter/ct.h +++ b/include/netlink/netfilter/ct.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/netfilter/ct.h Conntrack - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> * Copyright (c) 2007 Philip Craig <philipc@snapgear.com> * Copyright (c) 2007 Secure Computing Corporation @@ -18,6 +12,7 @@ #include <netlink/addr.h> #include <netlink/cache.h> #include <netlink/msg.h> +#include <netlink/attr.h> #ifdef __cplusplus extern "C" { @@ -37,6 +32,7 @@ extern int nfnl_ct_alloc_cache(struct nl_sock *, struct nl_cache **); extern int nfnlmsg_ct_group(struct nlmsghdr *); extern int nfnlmsg_ct_parse(struct nlmsghdr *, struct nfnl_ct **); +extern int nfnlmsg_ct_parse_nested(struct nlattr *, struct nfnl_ct **); extern void nfnl_ct_get(struct nfnl_ct *); extern void nfnl_ct_put(struct nfnl_ct *); diff --git a/include/netlink/netfilter/exp.h b/include/netlink/netfilter/exp.h index 736af24e..bd805144 100644 --- a/include/netlink/netfilter/exp.h +++ b/include/netlink/netfilter/exp.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/netfilter/exp.h Conntrack Expectation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> * Copyright (c) 2007 Philip Craig <philipc@snapgear.com> * Copyright (c) 2007 Secure Computing Corporation diff --git a/include/netlink/netfilter/log.h b/include/netlink/netfilter/log.h index e48eddff..a8ca81d6 100644 --- a/include/netlink/netfilter/log.h +++ b/include/netlink/netfilter/log.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/netfilter/log.h Netfilter Log - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> * Copyright (c) 2007 Philip Craig <philipc@snapgear.com> * Copyright (c) 2007 Secure Computing Corporation @@ -36,6 +30,7 @@ enum nfnl_log_copy_mode { enum nfnl_log_flags { NFNL_LOG_FLAG_SEQ = 0x1, NFNL_LOG_FLAG_SEQ_GLOBAL = 0x2, + NFNL_LOG_FLAG_CONNTRACK = 0x4, }; /* General */ diff --git a/include/netlink/netfilter/log_msg.h b/include/netlink/netfilter/log_msg.h index 63b0f642..b3672da6 100644 --- a/include/netlink/netfilter/log_msg.h +++ b/include/netlink/netfilter/log_msg.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/netfilter/log_msg.h Netfilter Log Message - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> * Copyright (c) 2007 Philip Craig <philipc@snapgear.com> * Copyright (c) 2007 Secure Computing Corporation @@ -23,6 +17,7 @@ extern "C" { struct nlmsghdr; struct nfnl_log_msg; +struct nfnl_ct; extern struct nl_object_ops log_msg_obj_ops; @@ -90,6 +85,36 @@ extern void nfnl_log_msg_set_seq_global(struct nfnl_log_msg *, uint32_t); extern int nfnl_log_msg_test_seq_global(const struct nfnl_log_msg *); extern uint32_t nfnl_log_msg_get_seq_global(const struct nfnl_log_msg *); +extern void nfnl_log_msg_set_hwtype(struct nfnl_log_msg *, uint16_t); +extern int nfnl_log_msg_test_hwtype(const struct nfnl_log_msg *); +extern uint16_t nfnl_log_msg_get_hwtype(const struct nfnl_log_msg *); + +extern void nfnl_log_msg_set_hwlen(struct nfnl_log_msg *, uint16_t); +extern int nfnl_log_msg_test_hwlen(const struct nfnl_log_msg *); +extern uint16_t nfnl_log_msg_get_hwlen(const struct nfnl_log_msg *); + +extern int nfnl_log_msg_set_hwheader(struct nfnl_log_msg *, void *, int); +extern int nfnl_log_msg_test_hwheader(const struct nfnl_log_msg *); +extern const void * nfnl_log_msg_get_hwheader(const struct nfnl_log_msg *, int *); + +extern void nfnl_log_msg_set_vlan_proto(struct nfnl_log_msg *, uint16_t); +extern int nfnl_log_msg_test_vlan_proto(const struct nfnl_log_msg *); +extern uint16_t nfnl_log_msg_get_vlan_proto(const struct nfnl_log_msg *); +extern void nfnl_log_msg_set_vlan_tag(struct nfnl_log_msg *, uint16_t); +extern int nfnl_log_msg_test_vlan_tag(const struct nfnl_log_msg *); +extern uint16_t nfnl_log_msg_get_vlan_tag(const struct nfnl_log_msg *); +extern uint16_t nfnl_log_msg_get_vlan_id(const struct nfnl_log_msg *); +extern uint16_t nfnl_log_msg_get_vlan_cfi(const struct nfnl_log_msg *); +extern uint16_t nfnl_log_msg_get_vlan_prio(const struct nfnl_log_msg *); + +extern void nfnl_log_msg_set_ct_info(struct nfnl_log_msg *, uint32_t); +extern int nfnl_log_msg_test_ct_info(const struct nfnl_log_msg *); +extern uint32_t nfnl_log_msg_get_ct_info(const struct nfnl_log_msg *); + +extern void nfnl_log_msg_set_ct(struct nfnl_log_msg *, struct nfnl_ct *); +extern int nfnl_log_msg_test_ct(const struct nfnl_log_msg *); +extern struct nfnl_ct * nfnl_log_msg_get_ct(const struct nfnl_log_msg *); + #ifdef __cplusplus } #endif diff --git a/include/netlink/netfilter/netfilter.h b/include/netlink/netfilter/netfilter.h index dd3589c0..f365a218 100644 --- a/include/netlink/netfilter/netfilter.h +++ b/include/netlink/netfilter/netfilter.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/netfilter/netfilter.h Netfilter generic functions - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008 Patrick McHardy <kaber@trash.net> */ diff --git a/include/netlink/netfilter/nfnl.h b/include/netlink/netfilter/nfnl.h index 8da4ba16..6e349ad3 100644 --- a/include/netlink/netfilter/nfnl.h +++ b/include/netlink/netfilter/nfnl.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/nfnl/nfnl.h Netfilter Netlink - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> * Copyright (c) 2007 Philip Craig <philipc@snapgear.com> * Copyright (c) 2007 Secure Computing Corporation diff --git a/include/netlink/netfilter/queue.h b/include/netlink/netfilter/queue.h index 224d4696..f393f4e7 100644 --- a/include/netlink/netfilter/queue.h +++ b/include/netlink/netfilter/queue.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/netfilter/queue.h Netfilter Queue - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2007, 2008 Patrick McHardy <kaber@trash.net> */ diff --git a/include/netlink/netfilter/queue_msg.h b/include/netlink/netfilter/queue_msg.h index 86f4b862..dc333e01 100644 --- a/include/netlink/netfilter/queue_msg.h +++ b/include/netlink/netfilter/queue_msg.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/netfilter/queue_msg.h Netfilter Queue Messages - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2007, 2008 Patrick McHardy <kaber@trash.net> */ diff --git a/include/netlink/netlink-compat.h b/include/netlink/netlink-compat.h index 2839ed03..ed71ed4e 100644 --- a/include/netlink/netlink-compat.h +++ b/include/netlink/netlink-compat.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/netlink-compat.h Netlink Compatability - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/netlink.h b/include/netlink/netlink.h index 41d48c68..c5ec3503 100644 --- a/include/netlink/netlink.h +++ b/include/netlink/netlink.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/netlink.h Netlink Interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/object-api.h b/include/netlink/object-api.h index 75f29cb5..d08bafa6 100644 --- a/include/netlink/object-api.h +++ b/include/netlink/object-api.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/object-api.h Object API - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/object.h b/include/netlink/object.h index b0c32c98..7448df61 100644 --- a/include/netlink/object.h +++ b/include/netlink/object.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/object.c Generic Cacheable Object - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/act/gact.h b/include/netlink/route/act/gact.h index 9538711b..b3a57f72 100644 --- a/include/netlink/route/act/gact.h +++ b/include/netlink/route/act/gact.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/act/gact.h gact action - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2016 Sushma Sitaram <sushma.sitaram@intel.com> */ diff --git a/include/netlink/route/act/mirred.h b/include/netlink/route/act/mirred.h index d65ed378..14fe9888 100644 --- a/include/netlink/route/act/mirred.h +++ b/include/netlink/route/act/mirred.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/cls/mirred.h mirred action - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Cong Wang <xiyou.wangcong@gmail.com> */ diff --git a/include/netlink/route/act/nat.h b/include/netlink/route/act/nat.h new file mode 100644 index 00000000..41295ce7 --- /dev/null +++ b/include/netlink/route/act/nat.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ +/* + * Copyright (c) 2016 Magnus Öberg <magnus.oberg@westermo.se> + */ + +#ifndef NETLINK_NAT_H_ +#define NETLINK_NAT_H_ + +#include <netlink/netlink.h> +#include <netlink/cache.h> +#include <netlink/route/action.h> +#include <linux/tc_act/tc_nat.h> + +#include <netinet/in.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern int rtnl_nat_set_old_addr(struct rtnl_act *act, in_addr_t addr); +extern int rtnl_nat_get_old_addr(struct rtnl_act *act, in_addr_t *addr); +extern int rtnl_nat_set_new_addr(struct rtnl_act *act, in_addr_t addr); +extern int rtnl_nat_get_new_addr(struct rtnl_act *act, in_addr_t *addr); +extern int rtnl_nat_set_mask(struct rtnl_act *act, in_addr_t bitmask); +extern int rtnl_nat_get_mask(struct rtnl_act *act, in_addr_t *bitmask); +extern int rtnl_nat_set_flags(struct rtnl_act *act, uint32_t flags); +extern int rtnl_nat_get_flags(struct rtnl_act *act, uint32_t *flags); +extern int rtnl_nat_set_action(struct rtnl_act *act, int action); +extern int rtnl_nat_get_action(struct rtnl_act *act, int *action); + +#ifdef __cplusplus +} +#endif + +#endif /* NETLINK_NAT_H */ diff --git a/include/netlink/route/act/skbedit.h b/include/netlink/route/act/skbedit.h index 69829e83..3e662ad4 100644 --- a/include/netlink/route/act/skbedit.h +++ b/include/netlink/route/act/skbedit.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/act/skbedit.h skbedit action - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2015 Cong Wang <xiyou.wangcong@gmail.com> */ diff --git a/include/netlink/route/act/vlan.h b/include/netlink/route/act/vlan.h index 3dcce7c7..f5001ba1 100644 --- a/include/netlink/route/act/vlan.h +++ b/include/netlink/route/act/vlan.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/act/vlan.h vlan action - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2018 Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com> */ diff --git a/include/netlink/route/action.h b/include/netlink/route/action.h index 7d4c1857..fed491ff 100644 --- a/include/netlink/route/action.h +++ b/include/netlink/route/action.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/action.h Actions - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Cong Wang <xiyou.wangcong@gmail.com> */ diff --git a/include/netlink/route/addr.h b/include/netlink/route/addr.h index 56c12e78..240ae485 100644 --- a/include/netlink/route/addr.h +++ b/include/netlink/route/addr.h @@ -1,14 +1,8 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/addr.c rtnetlink addr layer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> - * Copyright (c) 2003-2006 Baruch Even <baruch@ev-en.org>, - * Mediatrix Telecom, inc. <ericb@mediatrix.com> + * Copyright (c) 2003-2006 Baruch Even <baruch@ev-en.org> + * Copyright (c) 2003-2006 Mediatrix Telecom, inc. <ericb@mediatrix.com> */ #ifndef NETADDR_ADDR_H_ diff --git a/include/netlink/route/class.h b/include/netlink/route/class.h index 38333397..91252f16 100644 --- a/include/netlink/route/class.h +++ b/include/netlink/route/class.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/class.h Traffic Classes - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/classifier.h b/include/netlink/route/classifier.h index 18832ada..d92652b8 100644 --- a/include/netlink/route/classifier.h +++ b/include/netlink/route/classifier.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/classifier.h Classifiers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> */ @@ -26,6 +20,10 @@ extern void rtnl_cls_put(struct rtnl_cls *); extern int rtnl_cls_alloc_cache(struct nl_sock *, int, uint32_t, struct nl_cache **); +extern struct rtnl_cls *rtnl_cls_find_by_handle(struct nl_cache *cache, int ifindex, + uint32_t parent, uint32_t handle); +extern struct rtnl_cls *rtnl_cls_find_by_prio(struct nl_cache *cache, int ifindex, + uint32_t parent, uint16_t prio); extern void rtnl_cls_cache_set_tc_params(struct nl_cache *, int, uint32_t); diff --git a/include/netlink/route/cls/basic.h b/include/netlink/route/cls/basic.h index 51232ae0..98bbe678 100644 --- a/include/netlink/route/cls/basic.h +++ b/include/netlink/route/cls/basic.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/cls/basic.h Basic Classifier - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/cls/cgroup.h b/include/netlink/route/cls/cgroup.h index 9cd48454..8452f6cb 100644 --- a/include/netlink/route/cls/cgroup.h +++ b/include/netlink/route/cls/cgroup.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/cls/cgroup.h Control Groups Classifier - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2009-2010 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/cls/ematch.h b/include/netlink/route/cls/ematch.h index f4dac1df..4362423b 100644 --- a/include/netlink/route/cls/ematch.h +++ b/include/netlink/route/cls/ematch.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/cls/ematch.h Extended Matches - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/cls/ematch/cmp.h b/include/netlink/route/cls/ematch/cmp.h index 7afb7923..8aacb51e 100644 --- a/include/netlink/route/cls/ematch/cmp.h +++ b/include/netlink/route/cls/ematch/cmp.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/cls/ematch/cmp.h Simple Comparison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/cls/ematch/meta.h b/include/netlink/route/cls/ematch/meta.h index 2fe58990..b197246a 100644 --- a/include/netlink/route/cls/ematch/meta.h +++ b/include/netlink/route/cls/ematch/meta.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/cls/ematch/meta.h Metadata Match - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/cls/ematch/nbyte.h b/include/netlink/route/cls/ematch/nbyte.h index 014c719b..6bcf7f23 100644 --- a/include/netlink/route/cls/ematch/nbyte.h +++ b/include/netlink/route/cls/ematch/nbyte.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/cls/ematch/nbyte.h N-Byte Comparison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/cls/ematch/text.h b/include/netlink/route/cls/ematch/text.h index e599abf0..1493b097 100644 --- a/include/netlink/route/cls/ematch/text.h +++ b/include/netlink/route/cls/ematch/text.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/cls/ematch/text.h Text Search - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/cls/flower.h b/include/netlink/route/cls/flower.h new file mode 100644 index 00000000..1a772a85 --- /dev/null +++ b/include/netlink/route/cls/flower.h @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ +/* + * Copyright (c) 2018 Volodymyr Bendiuga <volodymyr.bendiuga@westermo.se> + */ + +#ifndef NETLINK_FLOWER_H_ +#define NETLINK_FLOWER_H_ + +#include <netlink/netlink.h> +#include <netlink/cache.h> +#include <netlink/route/classifier.h> +#include <netlink/route/action.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern int rtnl_flower_set_proto(struct rtnl_cls *cls, uint16_t); +extern int rtnl_flower_get_proto(struct rtnl_cls *cls, uint16_t *); + +extern int rtnl_flower_set_vlan_id(struct rtnl_cls *, uint16_t); +extern int rtnl_flower_get_vlan_id(struct rtnl_cls *, uint16_t *); + +extern int rtnl_flower_set_vlan_prio(struct rtnl_cls *, uint8_t); +extern int rtnl_flower_get_vlan_prio(struct rtnl_cls *, uint8_t *); + +extern int rtnl_flower_set_vlan_ethtype(struct rtnl_cls *, uint16_t); + +extern int rtnl_flower_set_dst_mac(struct rtnl_cls *, unsigned char *, + unsigned char *); +extern int rtnl_flower_get_dst_mac(struct rtnl_cls *, unsigned char *, + unsigned char *); + +extern int rtnl_flower_set_src_mac(struct rtnl_cls *, unsigned char *, + unsigned char *); +extern int rtnl_flower_get_src_mac(struct rtnl_cls *, unsigned char *, + unsigned char *); + +extern int rtnl_flower_set_ip_dscp(struct rtnl_cls *, uint8_t, uint8_t); +extern int rtnl_flower_get_ip_dscp(struct rtnl_cls *, uint8_t *, uint8_t *); + +extern int rtnl_flower_set_ipv4_src(struct rtnl_cls *, in_addr_t, in_addr_t); +extern int rtnl_flower_get_ipv4_src(struct rtnl_cls *, in_addr_t *, + in_addr_t *); +extern int rtnl_flower_set_ipv4_dst(struct rtnl_cls *, in_addr_t, in_addr_t); +extern int rtnl_flower_get_ipv4_dst(struct rtnl_cls *, in_addr_t *, + in_addr_t *); + +extern int rtnl_flower_set_flags(struct rtnl_cls *, int); + +extern int rtnl_flower_append_action(struct rtnl_cls *, struct rtnl_act *); +extern int rtnl_flower_del_action(struct rtnl_cls *, struct rtnl_act *); +extern struct rtnl_act* rtnl_flower_get_action(struct rtnl_cls *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/netlink/route/cls/fw.h b/include/netlink/route/cls/fw.h index 2e1bade0..57d7c3f6 100644 --- a/include/netlink/route/cls/fw.h +++ b/include/netlink/route/cls/fw.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/cls/fw.h fw classifier - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> * Copyright (c) 2006 Petr Gotthard <petr.gotthard@siemens.com> * Copyright (c) 2006 Siemens AG Oesterreich diff --git a/include/netlink/route/cls/matchall.h b/include/netlink/route/cls/matchall.h index 19556943..bfe1e7c5 100644 --- a/include/netlink/route/cls/matchall.h +++ b/include/netlink/route/cls/matchall.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/cls/matchall.h matchall classifier - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2017 Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com> */ diff --git a/include/netlink/route/cls/police.h b/include/netlink/route/cls/police.h index cd1efb07..9c18b87c 100644 --- a/include/netlink/route/cls/police.h +++ b/include/netlink/route/cls/police.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/cls/police.h Policer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/cls/u32.h b/include/netlink/route/cls/u32.h index 2443f513..b8f0223f 100644 --- a/include/netlink/route/cls/u32.h +++ b/include/netlink/route/cls/u32.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/cls/u32.h u32 classifier - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/link.h b/include/netlink/route/link.h index 8fd0994f..add464be 100644 --- a/include/netlink/route/link.h +++ b/include/netlink/route/link.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link.h Links (Interfaces) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> */ @@ -35,70 +29,71 @@ struct rtnl_link; * @ingroup link */ typedef enum { - RTNL_LINK_RX_PACKETS, /*!< Packets received */ - RTNL_LINK_TX_PACKETS, /*!< Packets sent */ - RTNL_LINK_RX_BYTES, /*!< Bytes received */ - RTNL_LINK_TX_BYTES, /*!< Bytes sent */ - RTNL_LINK_RX_ERRORS, /*!< Receive errors */ - RTNL_LINK_TX_ERRORS, /*!< Send errors */ - RTNL_LINK_RX_DROPPED, /*!< Received packets dropped */ - RTNL_LINK_TX_DROPPED, /*!< Packets dropped during transmit */ - RTNL_LINK_RX_COMPRESSED, /*!< Compressed packets received */ - RTNL_LINK_TX_COMPRESSED, /*!< Compressed packets sent */ - RTNL_LINK_RX_FIFO_ERR, /*!< Receive FIFO errors */ - RTNL_LINK_TX_FIFO_ERR, /*!< Send FIFO errors */ - RTNL_LINK_RX_LEN_ERR, /*!< Length errors */ - RTNL_LINK_RX_OVER_ERR, /*!< Over errors */ - RTNL_LINK_RX_CRC_ERR, /*!< CRC errors */ - RTNL_LINK_RX_FRAME_ERR, /*!< Frame errors */ - RTNL_LINK_RX_MISSED_ERR, /*!< Missed errors */ - RTNL_LINK_TX_ABORT_ERR, /*!< Aborted errors */ - RTNL_LINK_TX_CARRIER_ERR, /*!< Carrier errors */ - RTNL_LINK_TX_HBEAT_ERR, /*!< Heartbeat errors */ - RTNL_LINK_TX_WIN_ERR, /*!< Window errors */ - RTNL_LINK_COLLISIONS, /*!< Send collisions */ - RTNL_LINK_MULTICAST, /*!< Multicast */ - RTNL_LINK_IP6_INPKTS, /*!< IPv6 SNMP InReceives */ - RTNL_LINK_IP6_INHDRERRORS, /*!< IPv6 SNMP InHdrErrors */ - RTNL_LINK_IP6_INTOOBIGERRORS, /*!< IPv6 SNMP InTooBigErrors */ - RTNL_LINK_IP6_INNOROUTES, /*!< IPv6 SNMP InNoRoutes */ - RTNL_LINK_IP6_INADDRERRORS, /*!< IPv6 SNMP InAddrErrors */ - RTNL_LINK_IP6_INUNKNOWNPROTOS, /*!< IPv6 SNMP InUnknownProtos */ - RTNL_LINK_IP6_INTRUNCATEDPKTS, /*!< IPv6 SNMP InTruncatedPkts */ - RTNL_LINK_IP6_INDISCARDS, /*!< IPv6 SNMP InDiscards */ - RTNL_LINK_IP6_INDELIVERS, /*!< IPv6 SNMP InDelivers */ - RTNL_LINK_IP6_OUTFORWDATAGRAMS, /*!< IPv6 SNMP OutForwDatagrams */ - RTNL_LINK_IP6_OUTPKTS, /*!< IPv6 SNMP OutRequests */ - RTNL_LINK_IP6_OUTDISCARDS, /*!< IPv6 SNMP OutDiscards */ - RTNL_LINK_IP6_OUTNOROUTES, /*!< IPv6 SNMP OutNoRoutes */ - RTNL_LINK_IP6_REASMTIMEOUT, /*!< IPv6 SNMP ReasmTimeout */ - RTNL_LINK_IP6_REASMREQDS, /*!< IPv6 SNMP ReasmReqds */ - RTNL_LINK_IP6_REASMOKS, /*!< IPv6 SNMP ReasmOKs */ - RTNL_LINK_IP6_REASMFAILS, /*!< IPv6 SNMP ReasmFails */ - RTNL_LINK_IP6_FRAGOKS, /*!< IPv6 SNMP FragOKs */ - RTNL_LINK_IP6_FRAGFAILS, /*!< IPv6 SNMP FragFails */ - RTNL_LINK_IP6_FRAGCREATES, /*!< IPv6 SNMP FragCreates */ - RTNL_LINK_IP6_INMCASTPKTS, /*!< IPv6 SNMP InMcastPkts */ - RTNL_LINK_IP6_OUTMCASTPKTS, /*!< IPv6 SNMP OutMcastPkts */ - RTNL_LINK_IP6_INBCASTPKTS, /*!< IPv6 SNMP InBcastPkts */ - RTNL_LINK_IP6_OUTBCASTPKTS, /*!< IPv6 SNMP OutBcastPkts */ - RTNL_LINK_IP6_INOCTETS, /*!< IPv6 SNMP InOctets */ - RTNL_LINK_IP6_OUTOCTETS, /*!< IPv6 SNMP OutOctets */ - RTNL_LINK_IP6_INMCASTOCTETS, /*!< IPv6 SNMP InMcastOctets */ - RTNL_LINK_IP6_OUTMCASTOCTETS, /*!< IPv6 SNMP OutMcastOctets */ - RTNL_LINK_IP6_INBCASTOCTETS, /*!< IPv6 SNMP InBcastOctets */ - RTNL_LINK_IP6_OUTBCASTOCTETS, /*!< IPv6 SNMP OutBcastOctets */ - RTNL_LINK_ICMP6_INMSGS, /*!< ICMPv6 SNMP InMsgs */ - RTNL_LINK_ICMP6_INERRORS, /*!< ICMPv6 SNMP InErrors */ - RTNL_LINK_ICMP6_OUTMSGS, /*!< ICMPv6 SNMP OutMsgs */ - RTNL_LINK_ICMP6_OUTERRORS, /*!< ICMPv6 SNMP OutErrors */ - RTNL_LINK_ICMP6_CSUMERRORS, /*!< ICMPv6 SNMP InCsumErrors */ - RTNL_LINK_IP6_CSUMERRORS, /*!< IPv6 SNMP InCsumErrors */ - RTNL_LINK_IP6_NOECTPKTS, /*!< IPv6 SNMP InNoECTPkts */ - RTNL_LINK_IP6_ECT1PKTS, /*!< IPv6 SNMP InECT1Pkts */ - RTNL_LINK_IP6_ECT0PKTS, /*!< IPv6 SNMP InECT0Pkts */ - RTNL_LINK_IP6_CEPKTS, /*!< IPv6 SNMP InCEPkts */ - RTNL_LINK_RX_NOHANDLER, /*!< Received packets dropped on inactive device */ + RTNL_LINK_RX_PACKETS, /*!< Packets received */ + RTNL_LINK_TX_PACKETS, /*!< Packets sent */ + RTNL_LINK_RX_BYTES, /*!< Bytes received */ + RTNL_LINK_TX_BYTES, /*!< Bytes sent */ + RTNL_LINK_RX_ERRORS, /*!< Receive errors */ + RTNL_LINK_TX_ERRORS, /*!< Send errors */ + RTNL_LINK_RX_DROPPED, /*!< Received packets dropped */ + RTNL_LINK_TX_DROPPED, /*!< Packets dropped during transmit */ + RTNL_LINK_RX_COMPRESSED, /*!< Compressed packets received */ + RTNL_LINK_TX_COMPRESSED, /*!< Compressed packets sent */ + RTNL_LINK_RX_FIFO_ERR, /*!< Receive FIFO errors */ + RTNL_LINK_TX_FIFO_ERR, /*!< Send FIFO errors */ + RTNL_LINK_RX_LEN_ERR, /*!< Length errors */ + RTNL_LINK_RX_OVER_ERR, /*!< Over errors */ + RTNL_LINK_RX_CRC_ERR, /*!< CRC errors */ + RTNL_LINK_RX_FRAME_ERR, /*!< Frame errors */ + RTNL_LINK_RX_MISSED_ERR, /*!< Missed errors */ + RTNL_LINK_TX_ABORT_ERR, /*!< Aborted errors */ + RTNL_LINK_TX_CARRIER_ERR, /*!< Carrier errors */ + RTNL_LINK_TX_HBEAT_ERR, /*!< Heartbeat errors */ + RTNL_LINK_TX_WIN_ERR, /*!< Window errors */ + RTNL_LINK_COLLISIONS, /*!< Send collisions */ + RTNL_LINK_MULTICAST, /*!< Multicast */ + RTNL_LINK_IP6_INPKTS, /*!< IPv6 SNMP InReceives */ + RTNL_LINK_IP6_INHDRERRORS, /*!< IPv6 SNMP InHdrErrors */ + RTNL_LINK_IP6_INTOOBIGERRORS, /*!< IPv6 SNMP InTooBigErrors */ + RTNL_LINK_IP6_INNOROUTES, /*!< IPv6 SNMP InNoRoutes */ + RTNL_LINK_IP6_INADDRERRORS, /*!< IPv6 SNMP InAddrErrors */ + RTNL_LINK_IP6_INUNKNOWNPROTOS, /*!< IPv6 SNMP InUnknownProtos */ + RTNL_LINK_IP6_INTRUNCATEDPKTS, /*!< IPv6 SNMP InTruncatedPkts */ + RTNL_LINK_IP6_INDISCARDS, /*!< IPv6 SNMP InDiscards */ + RTNL_LINK_IP6_INDELIVERS, /*!< IPv6 SNMP InDelivers */ + RTNL_LINK_IP6_OUTFORWDATAGRAMS, /*!< IPv6 SNMP OutForwDatagrams */ + RTNL_LINK_IP6_OUTPKTS, /*!< IPv6 SNMP OutRequests */ + RTNL_LINK_IP6_OUTDISCARDS, /*!< IPv6 SNMP OutDiscards */ + RTNL_LINK_IP6_OUTNOROUTES, /*!< IPv6 SNMP OutNoRoutes */ + RTNL_LINK_IP6_REASMTIMEOUT, /*!< IPv6 SNMP ReasmTimeout */ + RTNL_LINK_IP6_REASMREQDS, /*!< IPv6 SNMP ReasmReqds */ + RTNL_LINK_IP6_REASMOKS, /*!< IPv6 SNMP ReasmOKs */ + RTNL_LINK_IP6_REASMFAILS, /*!< IPv6 SNMP ReasmFails */ + RTNL_LINK_IP6_FRAGOKS, /*!< IPv6 SNMP FragOKs */ + RTNL_LINK_IP6_FRAGFAILS, /*!< IPv6 SNMP FragFails */ + RTNL_LINK_IP6_FRAGCREATES, /*!< IPv6 SNMP FragCreates */ + RTNL_LINK_IP6_INMCASTPKTS, /*!< IPv6 SNMP InMcastPkts */ + RTNL_LINK_IP6_OUTMCASTPKTS, /*!< IPv6 SNMP OutMcastPkts */ + RTNL_LINK_IP6_INBCASTPKTS, /*!< IPv6 SNMP InBcastPkts */ + RTNL_LINK_IP6_OUTBCASTPKTS, /*!< IPv6 SNMP OutBcastPkts */ + RTNL_LINK_IP6_INOCTETS, /*!< IPv6 SNMP InOctets */ + RTNL_LINK_IP6_OUTOCTETS, /*!< IPv6 SNMP OutOctets */ + RTNL_LINK_IP6_INMCASTOCTETS, /*!< IPv6 SNMP InMcastOctets */ + RTNL_LINK_IP6_OUTMCASTOCTETS, /*!< IPv6 SNMP OutMcastOctets */ + RTNL_LINK_IP6_INBCASTOCTETS, /*!< IPv6 SNMP InBcastOctets */ + RTNL_LINK_IP6_OUTBCASTOCTETS, /*!< IPv6 SNMP OutBcastOctets */ + RTNL_LINK_ICMP6_INMSGS, /*!< ICMPv6 SNMP InMsgs */ + RTNL_LINK_ICMP6_INERRORS, /*!< ICMPv6 SNMP InErrors */ + RTNL_LINK_ICMP6_OUTMSGS, /*!< ICMPv6 SNMP OutMsgs */ + RTNL_LINK_ICMP6_OUTERRORS, /*!< ICMPv6 SNMP OutErrors */ + RTNL_LINK_ICMP6_CSUMERRORS, /*!< ICMPv6 SNMP InCsumErrors */ + RTNL_LINK_IP6_CSUMERRORS, /*!< IPv6 SNMP InCsumErrors */ + RTNL_LINK_IP6_NOECTPKTS, /*!< IPv6 SNMP InNoECTPkts */ + RTNL_LINK_IP6_ECT1PKTS, /*!< IPv6 SNMP InECT1Pkts */ + RTNL_LINK_IP6_ECT0PKTS, /*!< IPv6 SNMP InECT0Pkts */ + RTNL_LINK_IP6_CEPKTS, /*!< IPv6 SNMP InCEPkts */ + RTNL_LINK_RX_NOHANDLER, /*!< Received packets dropped on inactive device */ + RTNL_LINK_REASM_OVERLAPS, /*!< SNMP ReasmOverlaps */ __RTNL_LINK_STATS_MAX, } rtnl_link_stat_id_t; @@ -107,156 +102,156 @@ typedef enum { extern struct nla_policy rtln_link_policy[]; extern struct rtnl_link *rtnl_link_alloc(void); -extern void rtnl_link_put(struct rtnl_link *); +extern void rtnl_link_put(struct rtnl_link *); -extern int rtnl_link_alloc_cache(struct nl_sock *, int, struct nl_cache **); -extern int rtnl_link_alloc_cache_flags(struct nl_sock *, int, - struct nl_cache **, - unsigned int flags); +extern int rtnl_link_alloc_cache(struct nl_sock *, int, struct nl_cache **); +extern int rtnl_link_alloc_cache_flags(struct nl_sock *, int, + struct nl_cache **, + unsigned int flags); extern struct rtnl_link *rtnl_link_get(struct nl_cache *, int); extern struct rtnl_link *rtnl_link_get_by_name(struct nl_cache *, const char *); -extern int rtnl_link_build_add_request(struct rtnl_link *, int, - struct nl_msg **); -extern int rtnl_link_add(struct nl_sock *, struct rtnl_link *, int); -extern int rtnl_link_build_change_request(struct rtnl_link *, - struct rtnl_link *, int, - struct nl_msg **); -extern int rtnl_link_change(struct nl_sock *, struct rtnl_link *, - struct rtnl_link *, int); +extern int rtnl_link_build_add_request(struct rtnl_link *, int, + struct nl_msg **); +extern int rtnl_link_add(struct nl_sock *, struct rtnl_link *, int); +extern int rtnl_link_build_change_request(struct rtnl_link *, + struct rtnl_link *, int, + struct nl_msg **); +extern int rtnl_link_change(struct nl_sock *, struct rtnl_link *, + struct rtnl_link *, int); -extern int rtnl_link_build_delete_request(const struct rtnl_link *, - struct nl_msg **); -extern int rtnl_link_delete(struct nl_sock *, const struct rtnl_link *); -extern int rtnl_link_build_get_request(int, const char *, - struct nl_msg **); -extern int rtnl_link_get_kernel(struct nl_sock *, int, const char *, - struct rtnl_link **); +extern int rtnl_link_build_delete_request(const struct rtnl_link *, + struct nl_msg **); +extern int rtnl_link_delete(struct nl_sock *, const struct rtnl_link *); +extern int rtnl_link_build_get_request(int, const char *, + struct nl_msg **); +extern int rtnl_link_get_kernel(struct nl_sock *, int, const char *, + struct rtnl_link **); /* Name <-> Index Translations */ -extern char * rtnl_link_i2name(struct nl_cache *, int, char *, size_t); -extern int rtnl_link_name2i(struct nl_cache *, const char *); +extern char * rtnl_link_i2name(struct nl_cache *, int, char *, size_t); +extern int rtnl_link_name2i(struct nl_cache *, const char *); /* Name <-> Statistic Translations */ -extern char * rtnl_link_stat2str(int, char *, size_t); -extern int rtnl_link_str2stat(const char *); +extern char * rtnl_link_stat2str(int, char *, size_t); +extern int rtnl_link_str2stat(const char *); /* Link Flags Translations */ -extern char * rtnl_link_flags2str(int, char *, size_t); -extern int rtnl_link_str2flags(const char *); +extern char * rtnl_link_flags2str(int, char *, size_t); +extern int rtnl_link_str2flags(const char *); -extern char * rtnl_link_operstate2str(uint8_t, char *, size_t); -extern int rtnl_link_str2operstate(const char *); +extern char * rtnl_link_operstate2str(uint8_t, char *, size_t); +extern int rtnl_link_str2operstate(const char *); -extern char * rtnl_link_mode2str(uint8_t, char *, size_t); -extern int rtnl_link_str2mode(const char *); +extern char * rtnl_link_mode2str(uint8_t, char *, size_t); +extern int rtnl_link_str2mode(const char *); /* Carrier State Translations */ -extern char * rtnl_link_carrier2str(uint8_t, char *, size_t); -extern int rtnl_link_str2carrier(const char *); +extern char * rtnl_link_carrier2str(uint8_t, char *, size_t); +extern int rtnl_link_str2carrier(const char *); /* Access Functions */ -extern void rtnl_link_set_qdisc(struct rtnl_link *, const char *); -extern char * rtnl_link_get_qdisc(struct rtnl_link *); +extern void rtnl_link_set_qdisc(struct rtnl_link *, const char *); +extern char * rtnl_link_get_qdisc(struct rtnl_link *); -extern void rtnl_link_set_name(struct rtnl_link *, const char *); -extern char * rtnl_link_get_name(struct rtnl_link *); +extern void rtnl_link_set_name(struct rtnl_link *, const char *); +extern char * rtnl_link_get_name(struct rtnl_link *); -extern void rtnl_link_set_group(struct rtnl_link *, uint32_t); -extern uint32_t rtnl_link_get_group(struct rtnl_link *); +extern void rtnl_link_set_group(struct rtnl_link *, uint32_t); +extern uint32_t rtnl_link_get_group(struct rtnl_link *); -extern void rtnl_link_set_flags(struct rtnl_link *, unsigned int); -extern void rtnl_link_unset_flags(struct rtnl_link *, unsigned int); +extern void rtnl_link_set_flags(struct rtnl_link *, unsigned int); +extern void rtnl_link_unset_flags(struct rtnl_link *, unsigned int); extern unsigned int rtnl_link_get_flags(struct rtnl_link *); -extern void rtnl_link_set_mtu(struct rtnl_link *, unsigned int); +extern void rtnl_link_set_mtu(struct rtnl_link *, unsigned int); extern unsigned int rtnl_link_get_mtu(struct rtnl_link *); -extern void rtnl_link_set_txqlen(struct rtnl_link *, unsigned int); +extern void rtnl_link_set_txqlen(struct rtnl_link *, unsigned int); extern unsigned int rtnl_link_get_txqlen(struct rtnl_link *); -extern void rtnl_link_set_ifindex(struct rtnl_link *, int); -extern int rtnl_link_get_ifindex(struct rtnl_link *); +extern void rtnl_link_set_ifindex(struct rtnl_link *, int); +extern int rtnl_link_get_ifindex(struct rtnl_link *); -extern void rtnl_link_set_family(struct rtnl_link *, int); -extern int rtnl_link_get_family(struct rtnl_link *); +extern void rtnl_link_set_family(struct rtnl_link *, int); +extern int rtnl_link_get_family(struct rtnl_link *); -extern void rtnl_link_set_arptype(struct rtnl_link *, unsigned int); +extern void rtnl_link_set_arptype(struct rtnl_link *, unsigned int); extern unsigned int rtnl_link_get_arptype(struct rtnl_link *); -extern void rtnl_link_set_addr(struct rtnl_link *, struct nl_addr *); +extern void rtnl_link_set_addr(struct rtnl_link *, struct nl_addr *); extern struct nl_addr *rtnl_link_get_addr(struct rtnl_link *); -extern void rtnl_link_set_broadcast(struct rtnl_link *, struct nl_addr *); +extern void rtnl_link_set_broadcast(struct rtnl_link *, struct nl_addr *); extern struct nl_addr *rtnl_link_get_broadcast(struct rtnl_link *); -extern void rtnl_link_set_link(struct rtnl_link *, int); -extern int rtnl_link_get_link(struct rtnl_link *); +extern void rtnl_link_set_link(struct rtnl_link *, int); +extern int rtnl_link_get_link(struct rtnl_link *); -extern void rtnl_link_set_master(struct rtnl_link *, int); -extern int rtnl_link_get_master(struct rtnl_link *); +extern void rtnl_link_set_master(struct rtnl_link *, int); +extern int rtnl_link_get_master(struct rtnl_link *); -extern void rtnl_link_set_carrier(struct rtnl_link *, uint8_t); -extern uint8_t rtnl_link_get_carrier(struct rtnl_link *); +extern void rtnl_link_set_carrier(struct rtnl_link *, uint8_t); +extern uint8_t rtnl_link_get_carrier(struct rtnl_link *); -extern int rtnl_link_get_carrier_changes(struct rtnl_link *, uint32_t *); +extern int rtnl_link_get_carrier_changes(struct rtnl_link *, uint32_t *); -extern void rtnl_link_set_operstate(struct rtnl_link *, uint8_t); -extern uint8_t rtnl_link_get_operstate(struct rtnl_link *); +extern void rtnl_link_set_operstate(struct rtnl_link *, uint8_t); +extern uint8_t rtnl_link_get_operstate(struct rtnl_link *); -extern void rtnl_link_set_linkmode(struct rtnl_link *, uint8_t); -extern uint8_t rtnl_link_get_linkmode(struct rtnl_link *); +extern void rtnl_link_set_linkmode(struct rtnl_link *, uint8_t); +extern uint8_t rtnl_link_get_linkmode(struct rtnl_link *); int rtnl_link_set_link_netnsid(struct rtnl_link *link, int32_t link_netnsid); int rtnl_link_get_link_netnsid(const struct rtnl_link *link, int32_t *out_link_netnsid); -extern const char * rtnl_link_get_ifalias(struct rtnl_link *); -extern void rtnl_link_set_ifalias(struct rtnl_link *, const char *); +extern const char * rtnl_link_get_ifalias(struct rtnl_link *); +extern void rtnl_link_set_ifalias(struct rtnl_link *, const char *); -extern int rtnl_link_get_num_vf(struct rtnl_link *, uint32_t *); +extern int rtnl_link_get_num_vf(struct rtnl_link *, uint32_t *); extern uint64_t rtnl_link_get_stat(struct rtnl_link *, rtnl_link_stat_id_t); -extern int rtnl_link_set_stat(struct rtnl_link *, rtnl_link_stat_id_t, - const uint64_t); +extern int rtnl_link_set_stat(struct rtnl_link *, rtnl_link_stat_id_t, + const uint64_t); -extern int rtnl_link_set_type(struct rtnl_link *, const char *); -extern char * rtnl_link_get_type(struct rtnl_link *); +extern int rtnl_link_set_type(struct rtnl_link *, const char *); +extern char * rtnl_link_get_type(struct rtnl_link *); -extern int rtnl_link_set_slave_type(struct rtnl_link *, const char *); -extern const char * rtnl_link_get_slave_type(const struct rtnl_link *); +extern int rtnl_link_set_slave_type(struct rtnl_link *, const char *); +extern const char * rtnl_link_get_slave_type(const struct rtnl_link *); -extern void rtnl_link_set_promiscuity(struct rtnl_link *, uint32_t); -extern uint32_t rtnl_link_get_promiscuity(struct rtnl_link *); +extern void rtnl_link_set_promiscuity(struct rtnl_link *, uint32_t); +extern uint32_t rtnl_link_get_promiscuity(struct rtnl_link *); -extern void rtnl_link_set_num_tx_queues(struct rtnl_link *, uint32_t); -extern uint32_t rtnl_link_get_num_tx_queues(struct rtnl_link *); +extern void rtnl_link_set_num_tx_queues(struct rtnl_link *, uint32_t); +extern uint32_t rtnl_link_get_num_tx_queues(struct rtnl_link *); -extern void rtnl_link_set_num_rx_queues(struct rtnl_link *, uint32_t); -extern uint32_t rtnl_link_get_num_rx_queues(struct rtnl_link *); +extern void rtnl_link_set_num_rx_queues(struct rtnl_link *, uint32_t); +extern uint32_t rtnl_link_get_num_rx_queues(struct rtnl_link *); -extern int rtnl_link_get_gso_max_segs(struct rtnl_link *, uint32_t *); +extern int rtnl_link_get_gso_max_segs(struct rtnl_link *, uint32_t *); -extern int rtnl_link_get_gso_max_size(struct rtnl_link *, uint32_t *); +extern int rtnl_link_get_gso_max_size(struct rtnl_link *, uint32_t *); -extern struct nl_data * rtnl_link_get_phys_port_id(struct rtnl_link *); +extern struct nl_data * rtnl_link_get_phys_port_id(struct rtnl_link *); -extern char* rtnl_link_get_phys_port_name(struct rtnl_link *); +extern char* rtnl_link_get_phys_port_name(struct rtnl_link *); -extern struct nl_data * rtnl_link_get_phys_switch_id(struct rtnl_link *); +extern struct nl_data * rtnl_link_get_phys_switch_id(struct rtnl_link *); -extern void rtnl_link_set_ns_fd(struct rtnl_link *, int); -extern int rtnl_link_get_ns_fd(struct rtnl_link *); -extern void rtnl_link_set_ns_pid(struct rtnl_link *, pid_t); -extern pid_t rtnl_link_get_ns_pid(struct rtnl_link *); +extern void rtnl_link_set_ns_fd(struct rtnl_link *, int); +extern int rtnl_link_get_ns_fd(struct rtnl_link *); +extern void rtnl_link_set_ns_pid(struct rtnl_link *, pid_t); +extern pid_t rtnl_link_get_ns_pid(struct rtnl_link *); -extern int rtnl_link_enslave_ifindex(struct nl_sock *, int, int); -extern int rtnl_link_enslave(struct nl_sock *, struct rtnl_link *, - struct rtnl_link *); -extern int rtnl_link_release_ifindex(struct nl_sock *, int); -extern int rtnl_link_release(struct nl_sock *, struct rtnl_link *); -extern int rtnl_link_fill_info(struct nl_msg *, struct rtnl_link *); -extern int rtnl_link_info_parse(struct rtnl_link *, struct nlattr **); +extern int rtnl_link_enslave_ifindex(struct nl_sock *, int, int); +extern int rtnl_link_enslave(struct nl_sock *, struct rtnl_link *, + struct rtnl_link *); +extern int rtnl_link_release_ifindex(struct nl_sock *, int); +extern int rtnl_link_release(struct nl_sock *, struct rtnl_link *); +extern int rtnl_link_fill_info(struct nl_msg *, struct rtnl_link *); +extern int rtnl_link_info_parse(struct rtnl_link *, struct nlattr **); extern int rtnl_link_has_vf_list(struct rtnl_link *); extern void rtnl_link_set_vf_list(struct rtnl_link *); @@ -264,9 +259,9 @@ extern void rtnl_link_unset_vf_list(struct rtnl_link *); /* deprecated */ -extern int rtnl_link_set_info_type(struct rtnl_link *, const char *) __attribute__((deprecated)); -extern char * rtnl_link_get_info_type(struct rtnl_link *) __attribute__((deprecated)); -extern void rtnl_link_set_weight(struct rtnl_link *, unsigned int) __attribute__((deprecated)); +extern int rtnl_link_set_info_type(struct rtnl_link *, const char *) __attribute__((deprecated)); +extern char * rtnl_link_get_info_type(struct rtnl_link *) __attribute__((deprecated)); +extern void rtnl_link_set_weight(struct rtnl_link *, unsigned int) __attribute__((deprecated)); extern unsigned int rtnl_link_get_weight(struct rtnl_link *) __attribute__((deprecated)); diff --git a/include/netlink/route/link/api.h b/include/netlink/route/link/api.h index 03b1e5e5..abdd8b29 100644 --- a/include/netlink/route/link/api.h +++ b/include/netlink/route/link/api.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/api.h Link Modules API - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/link/bonding.h b/include/netlink/route/link/bonding.h index 5c34662d..09d495eb 100644 --- a/include/netlink/route/link/bonding.h +++ b/include/netlink/route/link/bonding.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/bonding.h Bonding Interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2011-2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/link/bridge.h b/include/netlink/route/link/bridge.h index f2e16e34..e606bd48 100644 --- a/include/netlink/route/link/bridge.h +++ b/include/netlink/route/link/bridge.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/bridge.h Bridge - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/link/can.h b/include/netlink/route/link/can.h index 1979a714..7df50e3d 100644 --- a/include/netlink/route/link/can.h +++ b/include/netlink/route/link/can.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/can.h CAN interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2012 Benedikt Spranger <b.spranger@linutronix.de> */ @@ -38,11 +32,11 @@ extern int rtnl_link_can_berr_tx(struct rtnl_link *); extern int rtnl_link_can_berr(struct rtnl_link *, struct can_berr_counter *); extern int rtnl_link_can_get_bt_const(struct rtnl_link *, - struct can_bittiming_const *); + struct can_bittiming_const *); extern int rtnl_link_can_get_bittiming(struct rtnl_link *, - struct can_bittiming *); + struct can_bittiming *); extern int rtnl_link_can_set_bittiming(struct rtnl_link *, - struct can_bittiming *); + const struct can_bittiming *); extern int rtnl_link_can_get_bitrate(struct rtnl_link *, uint32_t *); extern int rtnl_link_can_set_bitrate(struct rtnl_link *, uint32_t); @@ -57,6 +51,15 @@ extern int rtnl_link_can_get_ctrlmode(struct rtnl_link *, uint32_t *); extern int rtnl_link_can_set_ctrlmode(struct rtnl_link *, uint32_t); extern int rtnl_link_can_unset_ctrlmode(struct rtnl_link *, uint32_t); +extern int rtnl_link_can_get_data_bittiming_const(struct rtnl_link *, + struct can_bittiming_const *); +extern int rtnl_link_can_set_data_bittiming_const(struct rtnl_link *, + const struct can_bittiming_const *); +extern int rtnl_link_can_get_data_bittiming(struct rtnl_link *, + struct can_bittiming *); +extern int rtnl_link_can_set_data_bittiming(struct rtnl_link *, + const struct can_bittiming *); + #ifdef __cplusplus } #endif diff --git a/include/netlink/route/link/geneve.h b/include/netlink/route/link/geneve.h index aaba1f90..cf37c4e9 100644 --- a/include/netlink/route/link/geneve.h +++ b/include/netlink/route/link/geneve.h @@ -1,10 +1,4 @@ -/* - * netlink/route/link/geneve.h GENEVE interface - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - */ +/* SPDX-License-Identifier: LGPL-2.1-only */ #ifndef NETLINK_LINK_GENEVE_H_ #define NETLINK_LINK_GENEVE_H_ diff --git a/include/netlink/route/link/inet.h b/include/netlink/route/link/inet.h index 506542f6..2e93cc5b 100644 --- a/include/netlink/route/link/inet.h +++ b/include/netlink/route/link/inet.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/inet.h INET Link Module - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/link/inet6.h b/include/netlink/route/link/inet6.h index 666a9b83..cf257ca0 100644 --- a/include/netlink/route/link/inet6.h +++ b/include/netlink/route/link/inet6.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/inet6.h INET6 Link Module - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2014 Dan Williams <dcbw@redhat.com> */ diff --git a/include/netlink/route/link/info-api.h b/include/netlink/route/link/info-api.h index 1087ad48..11cffcfa 100644 --- a/include/netlink/route/link/info-api.h +++ b/include/netlink/route/link/info-api.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/info-api.h Link Modules API - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/link/ip6gre.h b/include/netlink/route/link/ip6gre.h new file mode 100644 index 00000000..28385925 --- /dev/null +++ b/include/netlink/route/link/ip6gre.h @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ + +#ifndef NETLINK_LINK_IP6GRE_H_ +#define NETLINK_LINK_IP6GRE_H_ + +#include <netlink/netlink.h> +#include <netlink/route/link.h> + +#ifdef __cplusplus +extern "C" { +#endif + + extern int rtnl_link_is_ip6gre(struct rtnl_link *link); + + extern struct rtnl_link *rtnl_link_ip6gre_alloc(void); + extern int rtnl_link_ip6gre_add(struct nl_sock *sk, const char *name); + + extern int rtnl_link_ip6gre_set_link(struct rtnl_link *link, uint32_t index); + extern int rtnl_link_ip6gre_get_link(struct rtnl_link *link, uint32_t *index); + + extern int rtnl_link_ip6gre_set_iflags(struct rtnl_link *link, uint16_t iflags); + extern int rtnl_link_ip6gre_get_iflags(struct rtnl_link *link, uint16_t *iflags); + + extern int rtnl_link_ip6gre_set_oflags(struct rtnl_link *link, uint16_t oflags); + extern int rtnl_link_ip6gre_get_oflags(struct rtnl_link *link, uint16_t *oflags); + + extern int rtnl_link_ip6gre_set_ikey(struct rtnl_link *link, uint32_t ikey); + extern int rtnl_link_ip6gre_get_ikey(struct rtnl_link *link, uint32_t *ikey); + + extern int rtnl_link_ip6gre_set_okey(struct rtnl_link *link, uint32_t okey); + extern int rtnl_link_ip6gre_get_okey(struct rtnl_link *link, uint32_t *okey); + + extern int rtnl_link_ip6gre_set_local(struct rtnl_link *link, struct in6_addr *local); + extern int rtnl_link_ip6gre_get_local(struct rtnl_link *link, struct in6_addr *local); + + extern int rtnl_link_ip6gre_set_remote(struct rtnl_link *link, struct in6_addr *remote); + extern int rtnl_link_ip6gre_get_remote(struct rtnl_link *link, struct in6_addr *remote); + + extern int rtnl_link_ip6gre_set_ttl(struct rtnl_link *link, uint8_t ttl); + extern int rtnl_link_ip6gre_get_ttl(struct rtnl_link *link, uint8_t *ttl); + + extern int rtnl_link_ip6gre_set_encaplimit(struct rtnl_link *link, uint8_t encaplimit); + extern int rtnl_link_ip6gre_get_encaplimit(struct rtnl_link *link, uint8_t *encaplimit); + + extern int rtnl_link_ip6gre_set_flowinfo(struct rtnl_link *link, uint32_t flowinfo); + extern int rtnl_link_ip6gre_get_flowinfo(struct rtnl_link *link, uint32_t *flowinfo); + + extern int rtnl_link_ip6gre_set_flags(struct rtnl_link *link, uint32_t flags); + extern int rtnl_link_ip6gre_get_flags(struct rtnl_link *link, uint32_t *flags); + + extern int rtnl_link_ip6gre_set_fwmark(struct rtnl_link *link, uint32_t fwmark); + extern int rtnl_link_ip6gre_get_fwmark(struct rtnl_link *link, uint32_t *fwmark); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/netlink/route/link/ip6tnl.h b/include/netlink/route/link/ip6tnl.h index 87ab164f..865d9738 100644 --- a/include/netlink/route/link/ip6tnl.h +++ b/include/netlink/route/link/ip6tnl.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/ip6tnl.h IP6TNL interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2014 Susant Sahani <susant@redhat.com> */ @@ -51,6 +45,9 @@ extern "C" { extern int rtnl_link_ip6_tnl_set_proto(struct rtnl_link *link, uint8_t proto); extern uint8_t rtnl_link_ip6_tnl_get_proto(struct rtnl_link *link); + extern int rtnl_link_ip6_tnl_set_fwmark(struct rtnl_link *link, uint32_t fwmark); + extern int rtnl_link_ip6_tnl_get_fwmark(struct rtnl_link *link, uint32_t *fwmark); + #ifdef __cplusplus } #endif diff --git a/include/netlink/route/link/ip6vti.h b/include/netlink/route/link/ip6vti.h new file mode 100644 index 00000000..bfe33d31 --- /dev/null +++ b/include/netlink/route/link/ip6vti.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ + +#ifndef NETLINK_LINK_IP6VTI_H_ +#define NETLINK_LINK_IP6VTI_H_ + +#include <netlink/netlink.h> +#include <netlink/route/link.h> + +#ifdef __cplusplus +extern "C" { +#endif + + int rtnl_link_is_ip6vti(struct rtnl_link *link); + + extern struct rtnl_link *rtnl_link_ip6vti_alloc(void); + extern int rtnl_link_ip6vti_add(struct nl_sock *sk, const char *name); + + extern int rtnl_link_ip6vti_set_link(struct rtnl_link *link, uint32_t index); + extern int rtnl_link_ip6vti_get_link(struct rtnl_link *link, uint32_t *index); + + extern int rtnl_link_ip6vti_set_ikey(struct rtnl_link *link, uint32_t ikey); + extern int rtnl_link_ip6vti_get_ikey(struct rtnl_link *link, uint32_t *ikey); + + extern int rtnl_link_ip6vti_set_okey(struct rtnl_link *link, uint32_t okey); + extern int rtnl_link_ip6vti_get_okey(struct rtnl_link *link, uint32_t *okey); + + extern int rtnl_link_ip6vti_set_local(struct rtnl_link *link, struct in6_addr *local); + extern int rtnl_link_ip6vti_get_local(struct rtnl_link *link, struct in6_addr *remote); + + extern int rtnl_link_ip6vti_set_remote(struct rtnl_link *link, struct in6_addr *remote); + extern int rtnl_link_ip6vti_get_remote(struct rtnl_link *link, struct in6_addr *remote); + + extern int rtnl_link_ip6vti_set_fwmark(struct rtnl_link *link, uint32_t fwmark); + extern int rtnl_link_ip6vti_get_fwmark(struct rtnl_link *link, uint32_t *fwmark); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/netlink/route/link/ipgre.h b/include/netlink/route/link/ipgre.h index 4c5f86b0..09a49571 100644 --- a/include/netlink/route/link/ipgre.h +++ b/include/netlink/route/link/ipgre.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/ip_gre.h IPGRE interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2014 Susant Sahani <susant@redhat.com> */ @@ -57,6 +51,9 @@ extern "C" { extern int rtnl_link_ipgre_set_pmtudisc(struct rtnl_link *link, uint8_t pmtudisc); extern uint8_t rtnl_link_ipgre_get_pmtudisc(struct rtnl_link *link); + extern int rtnl_link_ipgre_set_fwmark(struct rtnl_link *link, uint32_t fwmark); + extern int rtnl_link_ipgre_get_fwmark(struct rtnl_link *link, uint32_t *fwmark); + #ifdef __cplusplus } #endif diff --git a/include/netlink/route/link/ipip.h b/include/netlink/route/link/ipip.h index a7f51583..65d9f187 100644 --- a/include/netlink/route/link/ipip.h +++ b/include/netlink/route/link/ipip.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/ipip.h IPIP interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2014 Susant Sahani <susant@redhat.com> */ @@ -41,6 +35,9 @@ extern "C" { extern int rtnl_link_ipip_set_pmtudisc(struct rtnl_link *link, uint8_t pmtudisc); extern uint8_t rtnl_link_ipip_get_pmtudisc(struct rtnl_link *link); + extern int rtnl_link_ipip_set_fwmark(struct rtnl_link *link, uint32_t fwmark); + extern int rtnl_link_ipip_get_fwmark(struct rtnl_link *link, uint32_t *fwmark); + #ifdef __cplusplus } #endif diff --git a/include/netlink/route/link/ipvlan.h b/include/netlink/route/link/ipvlan.h index d13bcbbc..09b1d2db 100644 --- a/include/netlink/route/link/ipvlan.h +++ b/include/netlink/route/link/ipvlan.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/ipvlan.h IPVLAN interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2015 Cong Wang <cwang@twopensource.com> */ diff --git a/include/netlink/route/link/ipvti.h b/include/netlink/route/link/ipvti.h index c97e57f8..8e31dab9 100644 --- a/include/netlink/route/link/ipvti.h +++ b/include/netlink/route/link/ipvti.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/ipvti.h IPVTI interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2014 Susant Sahani <susant@redhat.com> */ @@ -38,6 +32,9 @@ extern "C" { extern int rtnl_link_ipvti_set_remote(struct rtnl_link *link, uint32_t addr); extern uint32_t rtnl_link_ipvti_get_remote(struct rtnl_link *link); + extern int rtnl_link_ipvti_set_fwmark(struct rtnl_link *link, uint32_t fwmark); + extern int rtnl_link_ipvti_get_fwmark(struct rtnl_link *link, uint32_t *fwmark); + #ifdef __cplusplus } #endif diff --git a/include/netlink/route/link/macsec.h b/include/netlink/route/link/macsec.h index ace4de2d..3139b478 100644 --- a/include/netlink/route/link/macsec.h +++ b/include/netlink/route/link/macsec.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/macsec.h MACsec Link Info - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2016 Sabrina Dubroca <sd@queasysnail.net> */ @@ -43,6 +37,9 @@ int rtnl_link_macsec_get_protect(struct rtnl_link *, uint8_t *); int rtnl_link_macsec_set_encrypt(struct rtnl_link *, uint8_t); int rtnl_link_macsec_get_encrypt(struct rtnl_link *, uint8_t *); +int rtnl_link_macsec_set_offload(struct rtnl_link *, uint8_t); +int rtnl_link_macsec_get_offload(struct rtnl_link *, uint8_t *); + int rtnl_link_macsec_set_encoding_sa(struct rtnl_link *, uint8_t); int rtnl_link_macsec_get_encoding_sa(struct rtnl_link *, uint8_t *); diff --git a/include/netlink/route/link/macvlan.h b/include/netlink/route/link/macvlan.h index 15a6cc1c..7c133cb3 100644 --- a/include/netlink/route/link/macvlan.h +++ b/include/netlink/route/link/macvlan.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/macvlan.h MACVLAN interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Michael Braun <michael-dev@fami-braun.de> */ diff --git a/include/netlink/route/link/macvtap.h b/include/netlink/route/link/macvtap.h index affcddc7..6fff30d6 100644 --- a/include/netlink/route/link/macvtap.h +++ b/include/netlink/route/link/macvtap.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/macvtap.h MACVTAP interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2015 Beniamino Galvani <bgalvani@redhat.com> */ diff --git a/include/netlink/route/link/ppp.h b/include/netlink/route/link/ppp.h index 4ff811d1..d65582a0 100644 --- a/include/netlink/route/link/ppp.h +++ b/include/netlink/route/link/ppp.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/ppp.h PPP Interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2016 Jonas Johansson <jonasj76@gmail.com> */ diff --git a/include/netlink/route/link/sit.h b/include/netlink/route/link/sit.h index d6f58519..f41e101d 100644 --- a/include/netlink/route/link/sit.h +++ b/include/netlink/route/link/sit.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/sit.h SIT interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2014 Susant Sahani <susant@redhat.com> */ @@ -60,6 +54,9 @@ extern "C" { int rtnl_link_sit_set_ip6rd_relay_prefixlen(struct rtnl_link *link, uint16_t prefix); int rtnl_link_sit_get_ip6rd_relay_prefixlen(struct rtnl_link *link, uint16_t *prefix); + extern int rtnl_link_sit_set_fwmark(struct rtnl_link *link, uint32_t fwmark); + extern int rtnl_link_sit_get_fwmark(struct rtnl_link *link, uint32_t *fwmark); + #ifdef __cplusplus } #endif diff --git a/include/netlink/route/link/sriov.h b/include/netlink/route/link/sriov.h index 3f7cacf7..36d66bf1 100644 --- a/include/netlink/route/link/sriov.h +++ b/include/netlink/route/link/sriov.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * include/netlink/route/link/sriov.h SRIOV VF Info - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2016 Intel Corp. All rights reserved. * Copyright (c) 2016 Jef Oliver <jef.oliver@intel.com> */ diff --git a/include/netlink/route/link/team.h b/include/netlink/route/link/team.h new file mode 100644 index 00000000..a55cdf9e --- /dev/null +++ b/include/netlink/route/link/team.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ +/* + * Copyright (c) 2015 Jonas Johansson <jonasj76@gmail.com> + */ + +#ifndef NETLINK_LINK_TEAM_H_ +#define NETLINK_LINK_TEAM_H_ + +#include <netlink/netlink.h> +#include <netlink/route/link.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct rtnl_link *rtnl_link_team_alloc(void); + +extern int rtnl_link_team_add(struct nl_sock *, const char *, + struct rtnl_link *); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/include/netlink/route/link/veth.h b/include/netlink/route/link/veth.h index 35c2345c..66a0d931 100644 --- a/include/netlink/route/link/veth.h +++ b/include/netlink/route/link/veth.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/veth.h VETH interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Cong Wang <xiyou.wangcong@gmail.com> */ diff --git a/include/netlink/route/link/vlan.h b/include/netlink/route/link/vlan.h index 4ec751e5..2729d6ed 100644 --- a/include/netlink/route/link/vlan.h +++ b/include/netlink/route/link/vlan.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/vlan.h VLAN interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/link/vrf.h b/include/netlink/route/link/vrf.h index 0a56d91e..5d494371 100644 --- a/include/netlink/route/link/vrf.h +++ b/include/netlink/route/link/vrf.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/vrf.h VRF interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2015 Cumulus Networks. All rights reserved. * Copyright (c) 2015 David Ahern <dsa@cumulusnetworks.com> */ diff --git a/include/netlink/route/link/vxlan.h b/include/netlink/route/link/vxlan.h index a929a9fa..6321b09d 100644 --- a/include/netlink/route/link/vxlan.h +++ b/include/netlink/route/link/vxlan.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/vxlan.h VXLAN interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Yasunobu Chiba <yasu@dsl.gr.jp> */ diff --git a/include/netlink/route/link/xfrmi.h b/include/netlink/route/link/xfrmi.h index 6e4cda7b..094ea118 100644 --- a/include/netlink/route/link/xfrmi.h +++ b/include/netlink/route/link/xfrmi.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/link/xfrmi.h XFRMI interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2019 Eyal Birger <eyal.birger@gmail.com> * * Based on netlink/route/link/ipvti.h diff --git a/include/netlink/route/mdb.h b/include/netlink/route/mdb.h new file mode 100644 index 00000000..a65ea849 --- /dev/null +++ b/include/netlink/route/mdb.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ + +#ifndef NETLINK_MDB_H_ +#define NETLINK_MDB_H_ + +#include <netlink/netlink.h> +#include <netlink/cache.h> +#include <netlink/route/link.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct rtnl_mdb; +struct rtnl_mdb_entry; + +struct rtnl_mdb *rtnl_mdb_alloc(void); +void rtnl_mdb_put(struct rtnl_mdb *mdb); + +int rtnl_mdb_alloc_cache(struct nl_sock *sk, struct nl_cache **result); +int rtnl_mdb_alloc_cache_flags(struct nl_sock *sock, + struct nl_cache **result, + unsigned int flags); + +uint32_t rtnl_mdb_get_ifindex(struct rtnl_mdb *mdb); +void rtnl_mdb_add_entry(struct rtnl_mdb *mdb, + struct rtnl_mdb_entry *_entry); + +void rtnl_mdb_foreach_entry(struct rtnl_mdb *mdb, + void (*cb)(struct rtnl_mdb_entry *, void *), + void *arg); + +int rtnl_mdb_entry_get_ifindex(struct rtnl_mdb_entry *mdb_entry); +int rtnl_mdb_entry_get_vid(struct rtnl_mdb_entry *mdb_entry); +int rtnl_mdb_entry_get_state(struct rtnl_mdb_entry *mdb_entry); +struct nl_addr *rtnl_mdb_entry_get_addr(struct rtnl_mdb_entry + *mdb_entry); +uint16_t rtnl_mdb_entry_get_proto(struct rtnl_mdb_entry *mdb_entry); +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/netlink/route/neighbour.h b/include/netlink/route/neighbour.h index 0f17b66e..37604149 100644 --- a/include/netlink/route/neighbour.h +++ b/include/netlink/route/neighbour.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/neighbour.h Neighbours - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/neightbl.h b/include/netlink/route/neightbl.h index 6c6c9a57..8bcdab25 100644 --- a/include/netlink/route/neightbl.h +++ b/include/netlink/route/neightbl.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/neightbl.h Neighbour Tables - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/netconf.h b/include/netlink/route/netconf.h index 19934381..7006c6ee 100644 --- a/include/netlink/route/netconf.h +++ b/include/netlink/route/netconf.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/netconf.h rtnetlink netconf layer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2017 David Ahern <dsa@cumulusnetworks.com> */ diff --git a/include/netlink/route/nexthop.h b/include/netlink/route/nexthop.h index 5b422ddf..c4a2604a 100644 --- a/include/netlink/route/nexthop.h +++ b/include/netlink/route/nexthop.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/nexthop.h Routing Nexthop - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> */ @@ -70,6 +64,8 @@ extern int rtnl_route_nh_str2flags(const char *); extern int rtnl_route_nh_encap_mpls(struct rtnl_nexthop *nh, struct nl_addr *addr, uint8_t ttl); +extern struct nl_addr * rtnl_route_nh_get_encap_mpls_dst(struct rtnl_nexthop *); +extern uint8_t rtnl_route_nh_get_encap_mpls_ttl(struct rtnl_nexthop *); #ifdef __cplusplus } #endif diff --git a/include/netlink/route/pktloc.h b/include/netlink/route/pktloc.h index c3768ce9..ab838211 100644 --- a/include/netlink/route/pktloc.h +++ b/include/netlink/route/pktloc.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/pktloc.h Packet Location Aliasing - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/qdisc.h b/include/netlink/route/qdisc.h index 10b85c5d..7d963a5c 100644 --- a/include/netlink/route/qdisc.h +++ b/include/netlink/route/qdisc.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/qdisc.h Queueing Disciplines - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> */ @@ -33,6 +27,8 @@ extern struct rtnl_qdisc * extern struct rtnl_qdisc * rtnl_qdisc_get_by_parent(struct nl_cache *, int, uint32_t); +extern struct rtnl_qdisc *rtnl_qdisc_get_by_kind(struct nl_cache *cache, + int ifindex, char *kind); extern int rtnl_qdisc_build_add_request(struct rtnl_qdisc *, int, struct nl_msg **); diff --git a/include/netlink/route/qdisc/cbq.h b/include/netlink/route/qdisc/cbq.h index 3dbdd2dc..3af6d88d 100644 --- a/include/netlink/route/qdisc/cbq.h +++ b/include/netlink/route/qdisc/cbq.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/sch/cbq.h Class Based Queueing - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/qdisc/dsmark.h b/include/netlink/route/qdisc/dsmark.h index 06bd9d38..b8c358f1 100644 --- a/include/netlink/route/qdisc/dsmark.h +++ b/include/netlink/route/qdisc/dsmark.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/sch/dsmark.h DSMARK - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/qdisc/fifo.h b/include/netlink/route/qdisc/fifo.h index c0334273..291aac50 100644 --- a/include/netlink/route/qdisc/fifo.h +++ b/include/netlink/route/qdisc/fifo.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/sch/fifo.c FIFO Qdisc - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/qdisc/fq_codel.h b/include/netlink/route/qdisc/fq_codel.h index d2c3d25e..1a69cd87 100644 --- a/include/netlink/route/qdisc/fq_codel.h +++ b/include/netlink/route/qdisc/fq_codel.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/sch/fq_codel.h fq_codel - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Cong Wang <xiyou.wangcong@gmail.com> */ diff --git a/include/netlink/route/qdisc/hfsc.h b/include/netlink/route/qdisc/hfsc.h index 4c338099..d6a64172 100644 --- a/include/netlink/route/qdisc/hfsc.h +++ b/include/netlink/route/qdisc/hfsc.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/sch/hfsc.h HFSC Qdisc - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2014 Cong Wang <xiyou.wangcong@gmail.com> */ diff --git a/include/netlink/route/qdisc/htb.h b/include/netlink/route/qdisc/htb.h index 5d7ca452..b7518554 100644 --- a/include/netlink/route/qdisc/htb.h +++ b/include/netlink/route/qdisc/htb.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/sch/htb.h HTB Qdisc - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> * Copyright (c) 2005 Petr Gotthard <petr.gotthard@siemens.com> * Copyright (c) 2005 Siemens AG Oesterreich diff --git a/include/netlink/route/qdisc/mqprio.h b/include/netlink/route/qdisc/mqprio.h index 1a38aeb2..0b26fdb1 100644 --- a/include/netlink/route/qdisc/mqprio.h +++ b/include/netlink/route/qdisc/mqprio.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * lib/route/qdisc/mqprio.c MQPRIO Qdisc/Class - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2018 Volodymyr Bendiuga <volodymyr.bendiuga@westermo.se> */ diff --git a/include/netlink/route/qdisc/netem.h b/include/netlink/route/qdisc/netem.h index 47c9dd83..5012ef57 100644 --- a/include/netlink/route/qdisc/netem.h +++ b/include/netlink/route/qdisc/netem.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/sch/netem.h Network Emulator Qdisc - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/qdisc/plug.h b/include/netlink/route/qdisc/plug.h index 40f7e53b..f14c0436 100644 --- a/include/netlink/route/qdisc/plug.h +++ b/include/netlink/route/qdisc/plug.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/qdisc/plug.c PLUG Qdisc - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2012 Shriram Rajagopalan <rshriram@cs.ubc.ca> */ diff --git a/include/netlink/route/qdisc/prio.h b/include/netlink/route/qdisc/prio.h index 636a8f92..28bcc1b8 100644 --- a/include/netlink/route/qdisc/prio.h +++ b/include/netlink/route/qdisc/prio.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/sch/prio.c PRIO Qdisc - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/qdisc/red.h b/include/netlink/route/qdisc/red.h index accb8d94..51d38ed7 100644 --- a/include/netlink/route/qdisc/red.h +++ b/include/netlink/route/qdisc/red.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/sch/red.h RED Qdisc - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/qdisc/sfq.h b/include/netlink/route/qdisc/sfq.h index 77d2e293..38ee0cef 100644 --- a/include/netlink/route/qdisc/sfq.h +++ b/include/netlink/route/qdisc/sfq.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/sch/sfq.c SFQ Qdisc - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/qdisc/tbf.h b/include/netlink/route/qdisc/tbf.h index ce31c548..b6c4f3dd 100644 --- a/include/netlink/route/qdisc/tbf.h +++ b/include/netlink/route/qdisc/tbf.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/sch/tbf.h TBF Qdisc - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/route.h b/include/netlink/route/route.h index 824dae35..38247628 100644 --- a/include/netlink/route/route.h +++ b/include/netlink/route/route.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/route.h Routes - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> */ @@ -58,6 +52,9 @@ extern void rtnl_route_get(struct rtnl_route *); extern int rtnl_route_parse(struct nlmsghdr *, struct rtnl_route **); extern int rtnl_route_build_msg(struct nl_msg *, struct rtnl_route *); +extern int rtnl_route_lookup(struct nl_sock *sk, struct nl_addr *dst, + struct rtnl_route **result); + extern int rtnl_route_build_add_request(struct rtnl_route *, int, struct nl_msg **); extern int rtnl_route_add(struct nl_sock *, struct rtnl_route *, int); diff --git a/include/netlink/route/rtnl.h b/include/netlink/route/rtnl.h index f551a5d3..6cae88f0 100644 --- a/include/netlink/route/rtnl.h +++ b/include/netlink/route/rtnl.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/rtnl.h Routing Netlink - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/rule.h b/include/netlink/route/rule.h index d0c335fc..26f5b52d 100644 --- a/include/netlink/route/rule.h +++ b/include/netlink/route/rule.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/rule.h Rules - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/tc-api.h b/include/netlink/route/tc-api.h index b7771b50..3f400baa 100644 --- a/include/netlink/route/tc-api.h +++ b/include/netlink/route/tc-api.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/tc-api.h Traffic Control API - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/route/tc.h b/include/netlink/route/tc.h index 51d670ae..ee55555f 100644 --- a/include/netlink/route/tc.h +++ b/include/netlink/route/tc.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/route/tc.h Traffic Control - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/socket.h b/include/netlink/socket.h index 9a68cad9..2bd98c37 100644 --- a/include/netlink/socket.h +++ b/include/netlink/socket.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/socket.h Netlink Socket - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/types.h b/include/netlink/types.h index 09cc5bd9..1e3a9a93 100644 --- a/include/netlink/types.h +++ b/include/netlink/types.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/types.h Definition of public types - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/utils.h b/include/netlink/utils.h index b05ce661..c62df828 100644 --- a/include/netlink/utils.h +++ b/include/netlink/utils.h @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/utils.h Utility Functions - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> */ @@ -19,6 +13,12 @@ extern "C" { #endif +#if defined(__GNUC__) && __GNUC__ > 5 +#define _nl_attribute_printf(a, b) __attribute__((__format__(printf, a, b))) +#else +#define _nl_attribute_printf(a, b) +#endif + /** * @name Probability Constants * @{ @@ -76,8 +76,8 @@ extern int nl_str2ip_proto(const char *); /* Dumping helpers */ extern void nl_new_line(struct nl_dump_params *); -extern void nl_dump(struct nl_dump_params *, const char *, ...); -extern void nl_dump_line(struct nl_dump_params *, const char *, ...); +extern void nl_dump(struct nl_dump_params *, const char *, ...) _nl_attribute_printf(2, 3); +extern void nl_dump_line(struct nl_dump_params *, const char *, ...) _nl_attribute_printf(2, 3); enum { NL_CAPABILITY_NONE, @@ -300,6 +300,25 @@ enum { NL_CAPABILITY_VERSION_3_5_0 = 30, #define NL_CAPABILITY_VERSION_3_5_0 NL_CAPABILITY_VERSION_3_5_0 + /** + * nl_object_identical() can consider objects identical, if they both lack the same + * set of ID attributes. + */ + NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL = 31, +#define NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL + + /** + * The library version is libnl3 3.6.0 or newer. This capability should never be backported. + */ + NL_CAPABILITY_VERSION_3_6_0 = 32, +#define NL_CAPABILITY_VERSION_3_6_0 NL_CAPABILITY_VERSION_3_6_0 + + /** + * The library version is libnl3 3.7.0 or newer. This capability should never be backported. + */ + NL_CAPABILITY_VERSION_3_7_0 = 33, +#define NL_CAPABILITY_VERSION_3_7_0 NL_CAPABILITY_VERSION_3_7_0 + __NL_CAPABILITY_MAX, NL_CAPABILITY_MAX = (__NL_CAPABILITY_MAX - 1), #define NL_CAPABILITY_MAX NL_CAPABILITY_MAX diff --git a/include/netlink/version.h.in b/include/netlink/version.h.in index 35bf2aa8..7fccc95b 100644 --- a/include/netlink/version.h.in +++ b/include/netlink/version.h.in @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * netlink/version.h Versioning Information - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2008-2011 Thomas Graf <tgraf@suug.ch> */ diff --git a/include/netlink/xfrm/sa.h b/include/netlink/xfrm/sa.h index 7362c361..cd5e552d 100644 --- a/include/netlink/xfrm/sa.h +++ b/include/netlink/xfrm/sa.h @@ -164,6 +164,9 @@ extern int xfrmnl_sa_set_replay_state_esn (struct xfrmnl_sa unsigned int, unsigned int, unsigned int, unsigned int, unsigned int*); +extern int xfrmnl_sa_get_user_offload (struct xfrmnl_sa*, int*, uint8_t *); +extern int xfrmnl_sa_set_user_offload (struct xfrmnl_sa*, int, uint8_t); + extern int xfrmnl_sa_is_expiry_reached (struct xfrmnl_sa*); extern int xfrmnl_sa_is_hardexpiry_reached (struct xfrmnl_sa*); |