netdev
[Top] [All Lists]

Re: BTW

To: "David S. Miller" <davem@xxxxxxxxxxxxx>
Subject: Re: BTW
From: Harald Welte <laforge@xxxxxxxxxxxxx>
Date: Wed, 27 Oct 2004 09:43:07 +0200
Cc: Linux Netdev List <netdev@xxxxxxxxxxx>
In-reply-to: <20041020214305.4dc40449.davem@xxxxxxxxxxxxx>
References: <20041020214305.4dc40449.davem@xxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
On Wed, Oct 20, 2004 at 09:43:05PM -0700, David S. Miller wrote:

> Linus has the tcp_diag changes in his tree from Herbert.
> So you can work on the updated version of your netlink
> changes if you wish.

Here you go. Please note I know that code way too little in order to
determine if it fully fixes all cases.

Signed-off-by: Harald Welte <laforge@xxxxxxxxxxxxx>

diff -Nru --exclude-from=/sunbeam/home/laforge/scripts/dontdiff 
linux-2.6.9-bk7/net/ipv4/tcp_diag.c 
linux-2.6.9-bk7-netlink_f_multi/net/ipv4/tcp_diag.c
--- linux-2.6.9-bk7/net/ipv4/tcp_diag.c 2004-10-22 18:18:52.000000000 +0200
+++ linux-2.6.9-bk7-netlink_f_multi/net/ipv4/tcp_diag.c 2004-10-22 
19:50:43.000000000 +0200
@@ -108,7 +108,7 @@
 }
 
 static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
-                       int ext, u32 pid, u32 seq)
+                       int ext, u32 pid, u32 seq, u16 nlmsg_flags)
 {
        struct inet_opt *inet = inet_sk(sk);
        struct tcp_opt *tp = tcp_sk(sk);
@@ -235,6 +235,7 @@
        }
 
        nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_flags = nlmsg_flags;
        return skb->len;
 
 nlmsg_failure:
@@ -291,7 +292,7 @@
 
        if (tcpdiag_fill(rep, sk, req->tcpdiag_ext,
                         NETLINK_CB(in_skb).pid,
-                        nlh->nlmsg_seq) <= 0)
+                        nlh->nlmsg_seq, 0) <= 0)
                BUG();
 
        err = netlink_unicast(tcpnl, rep, NETLINK_CB(in_skb).pid, MSG_DONTWAIT);
@@ -497,7 +498,7 @@
        }
 
        return tcpdiag_fill(skb, sk, r->tcpdiag_ext, NETLINK_CB(cb->skb).pid,
-                           cb->nlh->nlmsg_seq);
+                           cb->nlh->nlmsg_seq, NLM_F_MULTI);
 }
 
 static int tcpdiag_fill_req(struct sk_buff *skb, struct sock *sk,
@@ -512,6 +513,7 @@
 
        nlh = NLMSG_PUT(skb, pid, seq, TCPDIAG_GETSOCK, sizeof(*r));
        r = NLMSG_DATA(nlh);
+       nlh->nlmsg_flags = NLM_F_MULTI;
 
        r->tcpdiag_family = sk->sk_family;
        r->tcpdiag_state = TCP_SYN_RECV;
diff -Nru --exclude-from=/sunbeam/home/laforge/scripts/dontdiff 
linux-2.6.9-bk7/net/xfrm/xfrm_user.c 
linux-2.6.9-bk7-netlink_f_multi/net/xfrm/xfrm_user.c
--- linux-2.6.9-bk7/net/xfrm/xfrm_user.c        2004-10-18 23:54:32.000000000 
+0200
+++ linux-2.6.9-bk7-netlink_f_multi/net/xfrm/xfrm_user.c        2004-10-22 
18:17:42.000000000 +0200
@@ -351,7 +351,10 @@
        nlh = NLMSG_PUT(skb, NETLINK_CB(in_skb).pid,
                        sp->nlmsg_seq,
                        XFRM_MSG_NEWSA, sizeof(*p));
-       nlh->nlmsg_flags = 0;
+       if (NETLINK_CB(in_skb).pid && (count || sp->this_idx))
+               nlh->nlmsg_flags = NLM_F_MULTI;
+       else
+               nlh->nlmsg_flags = 0;
 
        p = NLMSG_DATA(nlh);
        copy_to_user_state(x, p);
-- 
- Harald Welte <laforge@xxxxxxxxxxxxx>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

Attachment: signature.asc
Description: Digital signature

<Prev in Thread] Current Thread [Next in Thread>