Skip to content

Commit

Permalink
[TCP]: Change tcp_diag to use the existing __RTA_PUT() macro.
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Jun 23, 2005
1 parent 317a76f commit 7c99c90
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions net/ipv4/tcp_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@ struct tcpdiag_entry
static struct sock *tcpnl;

#define TCPDIAG_PUT(skb, attrtype, attrlen) \
({ int rtalen = RTA_LENGTH(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); })
RTA_DATA(__RTA_PUT(skb, attrtype, attrlen))

static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
int ext, u32 pid, u32 seq, u16 nlmsg_flags)
Expand Down Expand Up @@ -167,6 +161,7 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
nlh->nlmsg_len = skb->tail - b;
return skb->len;

rtattr_failure:
nlmsg_failure:
skb_trim(skb, b - skb->data);
return -1;
Expand Down

0 comments on commit 7c99c90

Please sign in to comment.