提交 7c99c909 编写于 作者: S Stephen Hemminger 提交者: David S. Miller

[TCP]: Change tcp_diag to use the existing __RTA_PUT() macro.

Signed-off-by: NStephen Hemminger <shemminger@osdl.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 317a76f9
...@@ -43,13 +43,7 @@ struct tcpdiag_entry ...@@ -43,13 +43,7 @@ struct tcpdiag_entry
static struct sock *tcpnl; static struct sock *tcpnl;
#define TCPDIAG_PUT(skb, attrtype, attrlen) \ #define TCPDIAG_PUT(skb, attrtype, attrlen) \
({ int rtalen = RTA_LENGTH(attrlen); \ RTA_DATA(__RTA_PUT(skb, attrtype, attrlen))
struct rtattr *rta; \
if (skb_tailroom(skb) < RTA_ALIGN(rtalen)) goto nlmsg_failure; \
rta = (void*)__skb_put(skb, RTA_ALIGN(rtalen)); \
rta->rta_type = attrtype; \
rta->rta_len = rtalen; \
RTA_DATA(rta); })
static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk, static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
int ext, u32 pid, u32 seq, u16 nlmsg_flags) int ext, u32 pid, u32 seq, u16 nlmsg_flags)
...@@ -167,6 +161,7 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk, ...@@ -167,6 +161,7 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
nlh->nlmsg_len = skb->tail - b; nlh->nlmsg_len = skb->tail - b;
return skb->len; return skb->len;
rtattr_failure:
nlmsg_failure: nlmsg_failure:
skb_trim(skb, b - skb->data); skb_trim(skb, b - skb->data);
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册