netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* xfrm_user.c doesn't use NLMSG_F_MULTI
@ 2004-10-13  8:07 Harald Welte
  2004-10-14  9:52 ` Herbert Xu
  0 siblings, 1 reply; 8+ messages in thread
From: Harald Welte @ 2004-10-13  8:07 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

Hi!

If I send a GETSA with NLM_F_DUMP message from userspace, I receive a
batch of SA messages, but they apparently don't have the F_MULTI flag
set. 

Aren't they (all but the last msg) supposed to have the usual F_MULTI ?
Is this by intention or a mistake?

Cheers,
	Harald

-- 
- Harald Welte <laforge@gnumonks.org>               http://www.gnumonks.org/
============================================================================
Programming is like sex: One mistake and you have to support it your lifetime

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xfrm_user.c doesn't use NLMSG_F_MULTI
  2004-10-13  8:07 xfrm_user.c doesn't use NLMSG_F_MULTI Harald Welte
@ 2004-10-14  9:52 ` Herbert Xu
  2004-10-14 10:57   ` Harald Welte
  0 siblings, 1 reply; 8+ messages in thread
From: Herbert Xu @ 2004-10-14  9:52 UTC (permalink / raw)
  To: Harald Welte; +Cc: netdev

Harald Welte <laforge@gnumonks.org> wrote:
> 
> If I send a GETSA with NLM_F_DUMP message from userspace, I receive a
> batch of SA messages, but they apparently don't have the F_MULTI flag
> set. 
> 
> Aren't they (all but the last msg) supposed to have the usual F_MULTI ?
> Is this by intention or a mistake?

The documentation says so but none of the existing users really care.
The doco also says that the DONE message shouldn't have F_MULTI set
but it does :)

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xfrm_user.c doesn't use NLMSG_F_MULTI
  2004-10-14  9:52 ` Herbert Xu
@ 2004-10-14 10:57   ` Harald Welte
  2004-10-14 11:07     ` Herbert Xu
  0 siblings, 1 reply; 8+ messages in thread
From: Harald Welte @ 2004-10-14 10:57 UTC (permalink / raw)
  To: Herbert Xu; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 1151 bytes --]

On Thu, Oct 14, 2004 at 07:52:54PM +1000, Herbert Xu wrote:
> Harald Welte <laforge@gnumonks.org> wrote:
> > 
> > If I send a GETSA with NLM_F_DUMP message from userspace, I receive a
> > batch of SA messages, but they apparently don't have the F_MULTI flag
> > set. 
> > 
> > Aren't they (all but the last msg) supposed to have the usual F_MULTI ?
> > Is this by intention or a mistake?
> 
> The documentation says so but none of the existing users really care.

Well, people are developing more users, you know ;)  Somebody at
Astaro (http://www.astaro.com/) is investigating the possibilities of SA
synchronization for IPsec HA, and 

> The doco also says that the DONE message shouldn't have F_MULTI set
> but it does :)

Ok, would you like to receive a patch that fixes the xfrm netlink
interface to be more compatible with the netlink manpage and what
rtnetlink does?

> Cheers,

-- 
- Harald Welte <laforge@gnumonks.org>               http://www.gnumonks.org/
============================================================================
Programming is like sex: One mistake and you have to support it your lifetime

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xfrm_user.c doesn't use NLMSG_F_MULTI
  2004-10-14 10:57   ` Harald Welte
@ 2004-10-14 11:07     ` Herbert Xu
  2004-10-15 19:14       ` [PATCH 2.6] " Harald Welte
  0 siblings, 1 reply; 8+ messages in thread
From: Herbert Xu @ 2004-10-14 11:07 UTC (permalink / raw)
  To: Harald Welte; +Cc: netdev

On Thu, Oct 14, 2004 at 12:57:57PM +0200, Harald Welte wrote:
> 
> Ok, would you like to receive a patch that fixes the xfrm netlink
> interface to be more compatible with the netlink manpage and what
> rtnetlink does?

I have no objections at all :)

While you're at it please fix the other netlink users as well, e.g.,
tcp_diag.
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2.6] Re: xfrm_user.c doesn't use NLMSG_F_MULTI
  2004-10-14 11:07     ` Herbert Xu
@ 2004-10-15 19:14       ` Harald Welte
  2004-10-16  9:45         ` Herbert Xu
  0 siblings, 1 reply; 8+ messages in thread
From: Harald Welte @ 2004-10-15 19:14 UTC (permalink / raw)
  To: Herbert Xu; +Cc: netdev


[-- Attachment #1.1: Type: text/plain, Size: 1018 bytes --]

On Thu, Oct 14, 2004 at 09:07:42PM +1000, Herbert Xu wrote:
> On Thu, Oct 14, 2004 at 12:57:57PM +0200, Harald Welte wrote:
> > 
> > Ok, would you like to receive a patch that fixes the xfrm netlink
> > interface to be more compatible with the netlink manpage and what
> > rtnetlink does?
> 
> I have no objections at all :)
> 
> While you're at it please fix the other netlink users as well, e.g.,
> tcp_diag.

I did a short grep for netlink_dump and the only two places where
F_MULTI wasn't used was tcp_diag.c and xfrm_user.c.  Please let me know
if you know any other cases.

Pleae find a proposed patch attached to this email.  I didn't have the
means to test it at this point, though.. but it's pretty
straightforward.  Please consider applying it...

-- 
- Harald Welte <laforge@gnumonks.org>               http://www.gnumonks.org/
============================================================================
Programming is like sex: One mistake and you have to support it your lifetime

[-- Attachment #1.2: 2.6.9-rc3-bk9-netlink_f_multi.patch --]
[-- Type: text/plain, Size: 2393 bytes --]

Fix xfrm_user.c and tcp_diag.c netlink dump:  We have to set NLM_F_MULTI.

Signed-off-by: Harald Welte <laforge@gnumonks.org>

--- linux-2.6.9-rc3-bk9-test/net/ipv4/tcp_diag.c	2004-10-10 14:01:47.000000000 +0200
+++ linux-2.6.9-rc3-bk9-test-xfrm_netlink/net/ipv4/tcp_diag.c	2004-10-15 21:02:19.000000000 +0200
@@ -97,7 +97,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);
@@ -224,6 +224,7 @@
 	}
 
 	nlh->nlmsg_len = skb->tail - b;
+	nlh->nlmsg_flags = nlmsg_flags;
 	return skb->len;
 
 nlmsg_failure:
@@ -280,7 +281,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);
@@ -506,7 +507,8 @@
 					goto next_listen;
 				if (tcpdiag_fill(skb, sk, r->tcpdiag_ext,
 						 NETLINK_CB(cb->skb).pid,
-						 cb->nlh->nlmsg_seq) <= 0) {
+						 cb->nlh->nlmsg_seq,
+						 NLM_F_MULTI) <= 0) {
 					tcp_listen_unlock();
 					goto done;
 				}
@@ -550,7 +552,8 @@
 				goto next_normal;
 			if (tcpdiag_fill(skb, sk, r->tcpdiag_ext,
 					 NETLINK_CB(cb->skb).pid,
-					 cb->nlh->nlmsg_seq) <= 0) {
+					 cb->nlh->nlmsg_seq,
+					 NLM_F_MULTI) <= 0) {
 				read_unlock_bh(&head->lock);
 				goto done;
 			}
@@ -575,7 +578,8 @@
 					goto next_dying;
 				if (tcpdiag_fill(skb, sk, r->tcpdiag_ext,
 						 NETLINK_CB(cb->skb).pid,
-						 cb->nlh->nlmsg_seq) <= 0) {
+						 cb->nlh->nlmsg_seq,
+						 NLM_F_MULTI) <= 0) {
 					read_unlock_bh(&head->lock);
 					goto done;
 				}
diff -Nru linux-2.6.9-rc3-bk9-test/net/xfrm/xfrm_user.c linux-2.6.9-rc3-bk9-test-xfrm_netlink/net/xfrm/xfrm_user.c
--- linux-2.6.9-rc3-bk9-test/net/xfrm/xfrm_user.c	2004-10-10 14:01:03.000000000 +0200
+++ linux-2.6.9-rc3-bk9-test-xfrm_netlink/net/xfrm/xfrm_user.c	2004-10-15 20:55:58.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 (count != 0)
+		nlh->nlmsg_flags = NLM_F_MULTI;
+	else
+		nlh->nlmsg_flags = 0;
 
 	p = NLMSG_DATA(nlh);
 	copy_to_user_state(x, p);

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2.6] Re: xfrm_user.c doesn't use NLMSG_F_MULTI
  2004-10-15 19:14       ` [PATCH 2.6] " Harald Welte
@ 2004-10-16  9:45         ` Herbert Xu
  2004-10-20  6:12           ` David S. Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Herbert Xu @ 2004-10-16  9:45 UTC (permalink / raw)
  To: Harald Welte; +Cc: netdev

On Fri, Oct 15, 2004 at 09:14:44PM +0200, Harald Welte wrote:
> 
> Pleae find a proposed patch attached to this email.  I didn't have the
> means to test it at this point, though.. but it's pretty
> straightforward.  Please consider applying it...

Thanks for the patch.
 
> --- linux-2.6.9-rc3-bk9-test/net/ipv4/tcp_diag.c	2004-10-10 14:01:47.000000000 +0200
> +++ linux-2.6.9-rc3-bk9-test-xfrm_netlink/net/ipv4/tcp_diag.c	2004-10-15 21:02:19.000000000 +0200
> @@ -97,7 +97,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)

The patch looks OK.  But I have some pending patches in this area (see
http://oss.sgi.com/projects/netdev/archive/2004-10/msg00456.html).
Could you please hold off on it for a while?
  				}
> diff -Nru linux-2.6.9-rc3-bk9-test/net/xfrm/xfrm_user.c linux-2.6.9-rc3-bk9-test-xfrm_netlink/net/xfrm/xfrm_user.c
> --- linux-2.6.9-rc3-bk9-test/net/xfrm/xfrm_user.c	2004-10-10 14:01:03.000000000 +0200
> +++ linux-2.6.9-rc3-bk9-test-xfrm_netlink/net/xfrm/xfrm_user.c	2004-10-15 20:55:58.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 (count != 0)
> +		nlh->nlmsg_flags = NLM_F_MULTI;
> +	else
> +		nlh->nlmsg_flags = 0;
>  
>  	p = NLMSG_DATA(nlh);
>  	copy_to_user_state(x, p);

I think count can be zero when you're dumping as well.  You probably
want to change dump_one_policy while you're at it.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2.6] Re: xfrm_user.c doesn't use NLMSG_F_MULTI
  2004-10-16  9:45         ` Herbert Xu
@ 2004-10-20  6:12           ` David S. Miller
  2004-10-20  6:34             ` Harald Welte
  0 siblings, 1 reply; 8+ messages in thread
From: David S. Miller @ 2004-10-20  6:12 UTC (permalink / raw)
  To: Herbert Xu; +Cc: laforge, netdev

On Sat, 16 Oct 2004 19:45:53 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> > --- linux-2.6.9-rc3-bk9-test/net/ipv4/tcp_diag.c	2004-10-10 14:01:47.000000000 +0200
> > +++ linux-2.6.9-rc3-bk9-test-xfrm_netlink/net/ipv4/tcp_diag.c	2004-10-15 21:02:19.000000000 +0200
> > @@ -97,7 +97,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)
> 
> The patch looks OK.  But I have some pending patches in this area (see
> http://oss.sgi.com/projects/netdev/archive/2004-10/msg00456.html).
> Could you please hold off on it for a while?

I just installed Herbert's patches from that thread.
Harald, you can redo your patch against that thread's
patches or just wait until it hits Linus's tree tonight
or tomorrow.

Please also take care of the issue Herbert pointed out
in the xfrm_user.c case wrt. dumping.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2.6] Re: xfrm_user.c doesn't use NLMSG_F_MULTI
  2004-10-20  6:12           ` David S. Miller
@ 2004-10-20  6:34             ` Harald Welte
  0 siblings, 0 replies; 8+ messages in thread
From: Harald Welte @ 2004-10-20  6:34 UTC (permalink / raw)
  To: David S. Miller; +Cc: Herbert Xu, netdev

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

On Tue, Oct 19, 2004 at 11:12:56PM -0700, David S. Miller wrote:

> I just installed Herbert's patches from that thread.
> Harald, you can redo your patch against that thread's
> patches or just wait until it hits Linus's tree tonight
> or tomorrow.

I'd rather wait, more convenient ;)

> Please also take care of the issue Herbert pointed out
> in the xfrm_user.c case wrt. dumping.

yes, I'll do so.  I didn't fix it right now (and repost) since Herbert
asked me to hold back.

-- 
- Harald Welte <laforge@gnumonks.org>               http://www.gnumonks.org/
============================================================================
Programming is like sex: One mistake and you have to support it your lifetime

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-10-20  6:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-13  8:07 xfrm_user.c doesn't use NLMSG_F_MULTI Harald Welte
2004-10-14  9:52 ` Herbert Xu
2004-10-14 10:57   ` Harald Welte
2004-10-14 11:07     ` Herbert Xu
2004-10-15 19:14       ` [PATCH 2.6] " Harald Welte
2004-10-16  9:45         ` Herbert Xu
2004-10-20  6:12           ` David S. Miller
2004-10-20  6:34             ` Harald Welte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).