* Re: BTW
[not found] <20041020214305.4dc40449.davem@davemloft.net>
@ 2004-10-27 7:43 ` Harald Welte
2004-10-27 8:28 ` BTW Herbert Xu
0 siblings, 1 reply; 5+ messages in thread
From: Harald Welte @ 2004-10-27 7:43 UTC (permalink / raw)
To: David S. Miller; +Cc: Linux Netdev List
[-- Attachment #1: Type: text/plain, Size: 2849 bytes --]
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@netfilter.org>
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@netfilter.org> 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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: BTW
2004-10-27 7:43 ` BTW Harald Welte
@ 2004-10-27 8:28 ` Herbert Xu
2004-10-27 8:51 ` [PATCH 2.6] fix NLM_F_MULTI in tcp_diag and xfrm_user (was Re: BTW) Harald Welte
0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2004-10-27 8:28 UTC (permalink / raw)
To: Harald Welte; +Cc: davem, netdev
Harald Welte <laforge@netfilter.org> wrote:
>
> +++ 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;
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.
> @@ -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,
--
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] 5+ messages in thread
* [PATCH 2.6] fix NLM_F_MULTI in tcp_diag and xfrm_user (was Re: BTW)
2004-10-27 8:28 ` BTW Herbert Xu
@ 2004-10-27 8:51 ` Harald Welte
2004-10-27 9:40 ` Herbert Xu
0 siblings, 1 reply; 5+ messages in thread
From: Harald Welte @ 2004-10-27 8:51 UTC (permalink / raw)
To: Herbert Xu; +Cc: davem, netdev
[-- Attachment #1: Type: text/plain, Size: 4194 bytes --]
Sorry for submitting incomplete/stupid patches, but as indicated before,
I'm not familiar with that code at all.
> This doesn't set it for the tw sockets. So just set it at the top
> of the function instead.
done
> Yuck. Please put this into xfrm_dump_info.
done.
> And it would be good to fix the other dumper in this file (xfrm_dump_policy)
> as well.
done.
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-27 10:46:21.677098691 +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);
@@ -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;
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-27 10:45:09.780597181 +0200
@@ -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) {
--
- Harald Welte <laforge@netfilter.org> 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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2.6] fix NLM_F_MULTI in tcp_diag and xfrm_user (was Re: BTW)
2004-10-27 8:51 ` [PATCH 2.6] fix NLM_F_MULTI in tcp_diag and xfrm_user (was Re: BTW) Harald Welte
@ 2004-10-27 9:40 ` Herbert Xu
2004-10-27 21:42 ` David S. Miller
0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2004-10-27 9:40 UTC (permalink / raw)
To: Harald Welte; +Cc: davem, netdev
On Wed, Oct 27, 2004 at 10:51:41AM +0200, Harald Welte wrote:
> 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 <herbert@gondor.apana.org.au>
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] 5+ messages in thread
* Re: [PATCH 2.6] fix NLM_F_MULTI in tcp_diag and xfrm_user (was Re: BTW)
2004-10-27 9:40 ` Herbert Xu
@ 2004-10-27 21:42 ` David S. Miller
0 siblings, 0 replies; 5+ messages in thread
From: David S. Miller @ 2004-10-27 21:42 UTC (permalink / raw)
To: Herbert Xu; +Cc: laforge, netdev
On Wed, 27 Oct 2004 19:40:57 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:
> On Wed, Oct 27, 2004 at 10:51:41AM +0200, Harald Welte wrote:
> > 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 <herbert@gondor.apana.org.au>
Applied, thanks everyone :-)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-10-27 21:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20041020214305.4dc40449.davem@davemloft.net>
2004-10-27 7:43 ` BTW Harald Welte
2004-10-27 8:28 ` BTW Herbert Xu
2004-10-27 8:51 ` [PATCH 2.6] fix NLM_F_MULTI in tcp_diag and xfrm_user (was Re: BTW) Harald Welte
2004-10-27 9:40 ` Herbert Xu
2004-10-27 21:42 ` David S. Miller
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).