BTW
Subsystems (4)
Quoted 3 lines · David S. Miller
Linus has the
tcp_diagchanges 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.
net/ipv4/tcp_diag.c +5 -3
@@ -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 ;
net/xfrm/xfrm_user.c +4 -1
@@ -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);
Signature · 5 lines
- Harald Welte <[email protected]> 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
Herbert Xu
maintainerQuoted 12 lines · Harald Welte
+++
linux-2.6.9-bk7-netlink_f_multi/net/ipv4/tcp_diag.c2004-10-22 19:50:43.000000000 +0200net/ipv4/tcp_diag.c +1
-1@@ -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);
net/ipv4/tcp_diag.c line 238
Quoted 4 lines
net/ipv4/tcp_diag.c +1
-0@@ -235,6 +235,7 @@ } nlh->nlmsg_len = skb->tail - b; + nlh->nlmsg_flags = nlmsg_flags;
This doesn't set it for the tw sockets. So just set it at the top of the function instead.
The rest of the tcp_diag stuff looks good.
net/xfrm/xfrm_user.c line 357
Quoted 9 lines
net/xfrm/xfrm_user.c +4
-1@@ -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 ;
Yuck. Please put this into xfrm_dump_info.
And it would be good to fix the other dumper in this file (xfrm_dump_policy) as well.
Thanks,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtPATCH 1/1 fix NLM_F_MULTI in tcp_diag and xfrm_user (was Re: BTW)
Sorry for submitting incomplete/stupid patches, but as indicated before, I'm not familiar with that code at all.
Quoted 2 lines
This doesn't set it for the tw sockets. So just set it at the top of the function instead.
done
Quoted 1 line
Yuck. Please put this into
xfrm_dump_info.
done.
Quoted 2 lines
And it would be good to fix the other dumper in this file (
xfrm_dump_policy) as well.
done.
net/ipv4/tcp_diag.c +5 -3
@@ -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);
@@ -120,6 +120,7 @@unsigned char *b = skb->tail; nlh =NLMSG_PUT (skb, pid, seq,TCPDIAG_GETSOCK ,sizeof (*r)); + nlh->nlmsg_flags = nlmsg_flags; r =NLMSG_DATA (nlh);if (sk->sk_state !=TCP_TIME_WAIT ) {if (ext & (1 <<(TCPDIAG_MEMINFO -1 )))
@@ -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,
@@ -511,6 +512,7 @@long tmo; nlh =NLMSG_PUT (skb, pid, seq,TCPDIAG_GETSOCK ,sizeof (*r)); + nlh->nlmsg_flags =NLM_F_MULTI ; r =NLMSG_DATA (nlh); r->tcpdiag_family = sk->sk_family;
net/xfrm/xfrm_user.c +7 -2
@@ -332,6 +332,7 @@struct sk_buff *in_skb;struct sk_buff *out_skb;u32 nlmsg_seq; +u16 nlmsg_flags;int start_idx;int this_idx; };
@@ -351,7 +352,7 @@ nlh =NLMSG_PUT (skb,NETLINK_CB (in_skb).pid, sp->nlmsg_seq,XFRM_MSG_NEWSA ,sizeof (*p)); - nlh->nlmsg_flags =0 ; + nlh->nlmsg_flags = sp->nlmsg_flags; p =NLMSG_DATA (nlh);copy_to_user_state (x, p);
@@ -386,6 +387,7 @@ info.in_skb = cb->skb; info.out_skb = skb; info.nlmsg_seq = cb->nlh->nlmsg_seq; + info.nlmsg_flags =NLM_F_MULTI ; info.this_idx =0 ; info.start_idx = cb->args[0 ]; (void )xfrm_state_walk (IPSEC_PROTO_ANY , dump_one_state, &info);
@@ -408,6 +410,7 @@ info.in_skb = in_skb; info.out_skb = skb; info.nlmsg_seq = seq; + info.nlmsg_flags =0 ; info.this_idx = info.start_idx =0 ;if (dump_one_state (x,0 , &info)) {
@@ -743,7 +746,7 @@ sp->nlmsg_seq, XFRM_MSG_NEWPOLICY, sizeof(*p)); p =NLMSG_DATA (nlh); - nlh->nlmsg_flags =0 ; + nlh->nlmsg_flags = sp->nlmsg_flags;copy_to_user_policy (xp, p, dir);if (copy_to_user_tmpl (xp, skb) <0 )
@@ -766,6 +769,7 @@ info.in_skb = cb->skb; info.out_skb = skb; info.nlmsg_seq = cb->nlh->nlmsg_seq; + info.nlmsg_flags =NLM_F_MULTI ; info.this_idx =0 ; info.start_idx = cb->args[0 ]; (void )xfrm_policy_walk (dump_one_policy, &info);
@@ -789,6 +793,7 @@ info.in_skb = in_skb; info.out_skb = skb; info.nlmsg_seq = seq; + info.nlmsg_flags =0 ; info.this_idx = info.start_idx =0 ;if (dump_one_policy (xp, dir,0 , &info) <0 ) {
Signature · 5 lines
- Harald Welte <[email protected]> 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
Herbert Xu
maintainerRe: [PATCH 2.6] fix NLM_F_MULTI in tcp_diag and xfrm_user (was Re: BTW)
Quoted 2 lines · Harald Welte
Sorry for submitting incomplete/stupid patches, but as indicated before, I'm not familiar with that code at all.
Thank you very much for persisting in this. It looks great.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtRe: [PATCH 2.6] fix NLM_F_MULTI in tcp_diag and xfrm_user (was Re: BTW)
Quoted 7 lines · On Wed, 27 Oct 2004 19:40:57 +1000 Herbert Xu <[email protected]>…
Quoted 2 lines · Harald Welte
Sorry for submitting incomplete/stupid patches, but as indicated before, I'm not familiar with that code at all.
Thank you very much for persisting in this. It looks great.
Signed-off-by Herbert Xu <[email protected]>
Applied, thanks everyone :-)