aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/dcbnl.h2
-rw-r--r--include/net/icmp.h1
-rw-r--r--include/net/ndisc.h1
-rw-r--r--include/net/netlink.h169
-rw-r--r--include/net/xfrm.h5
5 files changed, 106 insertions, 72 deletions
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index f55c980d8e23..fc5d5dcebb00 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -48,6 +48,8 @@ struct dcbnl_rtnl_ops {
48 /* IEEE 802.1Qaz std */ 48 /* IEEE 802.1Qaz std */
49 int (*ieee_getets) (struct net_device *, struct ieee_ets *); 49 int (*ieee_getets) (struct net_device *, struct ieee_ets *);
50 int (*ieee_setets) (struct net_device *, struct ieee_ets *); 50 int (*ieee_setets) (struct net_device *, struct ieee_ets *);
51 int (*ieee_getmaxrate) (struct net_device *, struct ieee_maxrate *);
52 int (*ieee_setmaxrate) (struct net_device *, struct ieee_maxrate *);
51 int (*ieee_getpfc) (struct net_device *, struct ieee_pfc *); 53 int (*ieee_getpfc) (struct net_device *, struct ieee_pfc *);
52 int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *); 54 int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *);
53 int (*ieee_getapp) (struct net_device *, struct dcb_app *); 55 int (*ieee_getapp) (struct net_device *, struct dcb_app *);
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 75d615649071..ce70a581d95c 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -41,7 +41,6 @@ struct net;
41 41
42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); 42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
43extern int icmp_rcv(struct sk_buff *skb); 43extern int icmp_rcv(struct sk_buff *skb);
44extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
45extern int icmp_init(void); 44extern int icmp_init(void);
46extern void icmp_out_count(struct net *net, unsigned char type); 45extern void icmp_out_count(struct net *net, unsigned char type);
47 46
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 6f9c25a76cd1..c02b6ad3f6c5 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -34,6 +34,7 @@ enum {
34 __ND_OPT_ARRAY_MAX, 34 __ND_OPT_ARRAY_MAX,
35 ND_OPT_ROUTE_INFO = 24, /* RFC4191 */ 35 ND_OPT_ROUTE_INFO = 24, /* RFC4191 */
36 ND_OPT_RDNSS = 25, /* RFC5006 */ 36 ND_OPT_RDNSS = 25, /* RFC5006 */
37 ND_OPT_DNSSL = 31, /* RFC6106 */
37 __ND_OPT_MAX 38 __ND_OPT_MAX
38}; 39};
39 40
diff --git a/include/net/netlink.h b/include/net/netlink.h
index f394fe5d7641..785f37a3b44e 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -102,20 +102,6 @@
102 * nla_put_flag(skb, type) add flag attribute to skb 102 * nla_put_flag(skb, type) add flag attribute to skb
103 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb 103 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb
104 * 104 *
105 * Exceptions Based Attribute Construction:
106 * NLA_PUT(skb, type, len, data) add attribute to skb
107 * NLA_PUT_U8(skb, type, value) add u8 attribute to skb
108 * NLA_PUT_U16(skb, type, value) add u16 attribute to skb
109 * NLA_PUT_U32(skb, type, value) add u32 attribute to skb
110 * NLA_PUT_U64(skb, type, value) add u64 attribute to skb
111 * NLA_PUT_STRING(skb, type, str) add string attribute to skb
112 * NLA_PUT_FLAG(skb, type) add flag attribute to skb
113 * NLA_PUT_MSECS(skb, type, jiffies) add msecs attribute to skb
114 *
115 * The meaning of these functions is equal to their lower case
116 * variants but they jump to the label nla_put_failure in case
117 * of a failure.
118 *
119 * Nested Attributes Construction: 105 * Nested Attributes Construction:
120 * nla_nest_start(skb, type) start a nested attribute 106 * nla_nest_start(skb, type) start a nested attribute
121 * nla_nest_end(skb, nla) finalize a nested attribute 107 * nla_nest_end(skb, nla) finalize a nested attribute
@@ -772,6 +758,39 @@ static inline int nla_put_u16(struct sk_buff *skb, int attrtype, u16 value)
772} 758}
773 759
774/** 760/**
761 * nla_put_be16 - Add a __be16 netlink attribute to a socket buffer
762 * @skb: socket buffer to add attribute to
763 * @attrtype: attribute type
764 * @value: numeric value
765 */
766static inline int nla_put_be16(struct sk_buff *skb, int attrtype, __be16 value)
767{
768 return nla_put(skb, attrtype, sizeof(__be16), &value);
769}
770
771/**
772 * nla_put_net16 - Add 16-bit network byte order netlink attribute to a socket buffer
773 * @skb: socket buffer to add attribute to
774 * @attrtype: attribute type
775 * @value: numeric value
776 */
777static inline int nla_put_net16(struct sk_buff *skb, int attrtype, __be16 value)
778{
779 return nla_put_be16(skb, attrtype | NLA_F_NET_BYTEORDER, value);
780}
781
782/**
783 * nla_put_le16 - Add a __le16 netlink attribute to a socket buffer
784 * @skb: socket buffer to add attribute to
785 * @attrtype: attribute type
786 * @value: numeric value
787 */
788static inline int nla_put_le16(struct sk_buff *skb, int attrtype, __le16 value)
789{
790 return nla_put(skb, attrtype, sizeof(__le16), &value);
791}
792
793/**
775 * nla_put_u32 - Add a u32 netlink attribute to a socket buffer 794 * nla_put_u32 - Add a u32 netlink attribute to a socket buffer
776 * @skb: socket buffer to add attribute to 795 * @skb: socket buffer to add attribute to
777 * @attrtype: attribute type 796 * @attrtype: attribute type
@@ -783,7 +802,40 @@ static inline int nla_put_u32(struct sk_buff *skb, int attrtype, u32 value)
783} 802}
784 803
785/** 804/**
786 * nla_put_64 - Add a u64 netlink attribute to a socket buffer 805 * nla_put_be32 - Add a __be32 netlink attribute to a socket buffer
806 * @skb: socket buffer to add attribute to
807 * @attrtype: attribute type
808 * @value: numeric value
809 */
810static inline int nla_put_be32(struct sk_buff *skb, int attrtype, __be32 value)
811{
812 return nla_put(skb, attrtype, sizeof(__be32), &value);
813}
814
815/**
816 * nla_put_net32 - Add 32-bit network byte order netlink attribute to a socket buffer
817 * @skb: socket buffer to add attribute to
818 * @attrtype: attribute type
819 * @value: numeric value
820 */
821static inline int nla_put_net32(struct sk_buff *skb, int attrtype, __be32 value)
822{
823 return nla_put_be32(skb, attrtype | NLA_F_NET_BYTEORDER, value);
824}
825
826/**
827 * nla_put_le32 - Add a __le32 netlink attribute to a socket buffer
828 * @skb: socket buffer to add attribute to
829 * @attrtype: attribute type
830 * @value: numeric value
831 */
832static inline int nla_put_le32(struct sk_buff *skb, int attrtype, __le32 value)
833{
834 return nla_put(skb, attrtype, sizeof(__le32), &value);
835}
836
837/**
838 * nla_put_u64 - Add a u64 netlink attribute to a socket buffer
787 * @skb: socket buffer to add attribute to 839 * @skb: socket buffer to add attribute to
788 * @attrtype: attribute type 840 * @attrtype: attribute type
789 * @value: numeric value 841 * @value: numeric value
@@ -794,6 +846,39 @@ static inline int nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
794} 846}
795 847
796/** 848/**
849 * nla_put_be64 - Add a __be64 netlink attribute to a socket buffer
850 * @skb: socket buffer to add attribute to
851 * @attrtype: attribute type
852 * @value: numeric value
853 */
854static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value)
855{
856 return nla_put(skb, attrtype, sizeof(__be64), &value);
857}
858
859/**
860 * nla_put_net64 - Add 64-bit network byte order netlink attribute to a socket buffer
861 * @skb: socket buffer to add attribute to
862 * @attrtype: attribute type
863 * @value: numeric value
864 */
865static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value)
866{
867 return nla_put_be64(skb, attrtype | NLA_F_NET_BYTEORDER, value);
868}
869
870/**
871 * nla_put_le64 - Add a __le64 netlink attribute to a socket buffer
872 * @skb: socket buffer to add attribute to
873 * @attrtype: attribute type
874 * @value: numeric value
875 */
876static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value)
877{
878 return nla_put(skb, attrtype, sizeof(__le64), &value);
879}
880
881/**
797 * nla_put_string - Add a string netlink attribute to a socket buffer 882 * nla_put_string - Add a string netlink attribute to a socket buffer
798 * @skb: socket buffer to add attribute to 883 * @skb: socket buffer to add attribute to
799 * @attrtype: attribute type 884 * @attrtype: attribute type
@@ -828,60 +913,6 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
828 return nla_put(skb, attrtype, sizeof(u64), &tmp); 913 return nla_put(skb, attrtype, sizeof(u64), &tmp);
829} 914}
830 915
831#define NLA_PUT(skb, attrtype, attrlen, data) \
832 do { \
833 if (unlikely(nla_put(skb, attrtype, attrlen, data) < 0)) \
834 goto nla_put_failure; \
835 } while(0)
836
837#define NLA_PUT_TYPE(skb, type, attrtype, value) \
838 do { \
839 type __tmp = value; \
840 NLA_PUT(skb, attrtype, sizeof(type), &__tmp); \
841 } while(0)
842
843#define NLA_PUT_U8(skb, attrtype, value) \
844 NLA_PUT_TYPE(skb, u8, attrtype, value)
845
846#define NLA_PUT_U16(skb, attrtype, value) \
847 NLA_PUT_TYPE(skb, u16, attrtype, value)
848
849#define NLA_PUT_LE16(skb, attrtype, value) \
850 NLA_PUT_TYPE(skb, __le16, attrtype, value)
851
852#define NLA_PUT_BE16(skb, attrtype, value) \
853 NLA_PUT_TYPE(skb, __be16, attrtype, value)
854
855#define NLA_PUT_NET16(skb, attrtype, value) \
856 NLA_PUT_BE16(skb, attrtype | NLA_F_NET_BYTEORDER, value)
857
858#define NLA_PUT_U32(skb, attrtype, value) \
859 NLA_PUT_TYPE(skb, u32, attrtype, value)
860
861#define NLA_PUT_BE32(skb, attrtype, value) \
862 NLA_PUT_TYPE(skb, __be32, attrtype, value)
863
864#define NLA_PUT_NET32(skb, attrtype, value) \
865 NLA_PUT_BE32(skb, attrtype | NLA_F_NET_BYTEORDER, value)
866
867#define NLA_PUT_U64(skb, attrtype, value) \
868 NLA_PUT_TYPE(skb, u64, attrtype, value)
869
870#define NLA_PUT_BE64(skb, attrtype, value) \
871 NLA_PUT_TYPE(skb, __be64, attrtype, value)
872
873#define NLA_PUT_NET64(skb, attrtype, value) \
874 NLA_PUT_BE64(skb, attrtype | NLA_F_NET_BYTEORDER, value)
875
876#define NLA_PUT_STRING(skb, attrtype, value) \
877 NLA_PUT(skb, attrtype, strlen(value) + 1, value)
878
879#define NLA_PUT_FLAG(skb, attrtype) \
880 NLA_PUT(skb, attrtype, 0, NULL)
881
882#define NLA_PUT_MSECS(skb, attrtype, jiffies) \
883 NLA_PUT_U64(skb, attrtype, jiffies_to_msecs(jiffies))
884
885/** 916/**
886 * nla_get_u32 - return payload of u32 attribute 917 * nla_get_u32 - return payload of u32 attribute
887 * @nla: u32 netlink attribute 918 * @nla: u32 netlink attribute
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 96239e78e621..1cb32bf107de 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1682,8 +1682,9 @@ static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
1682 1682
1683static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m) 1683static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
1684{ 1684{
1685 if (m->m | m->v) 1685 if ((m->m | m->v) &&
1686 NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m); 1686 nla_put(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m))
1687 goto nla_put_failure;
1687 return 0; 1688 return 0;
1688 1689
1689nla_put_failure: 1690nla_put_failure: