* [PATCH] inet_diag: add support for tw_mark
@ 2021-06-16 6:06 Maciej Żenczykowski
2021-06-16 6:18 ` Eric Dumazet
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Maciej Żenczykowski @ 2021-06-16 6:06 UTC (permalink / raw)
To: Maciej Żenczykowski
Cc: Linux Network Development Mailing List, David S . Miller ,
Hideaki YOSHIFUJI, David Ahern, Jakub Kicinski, Eric Dumazet,
Jon Maxwell
From: Maciej Żenczykowski <maze@google.com>
Timewait sockets have included mark since approx 4.18.
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jon Maxwell <jmaxwell37@gmail.com>
Fixes: 00483690552c ("tcp: Add mark for TIMEWAIT sockets")
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
net/ipv4/inet_diag.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 93474b1bea4e..e65f4ef024a4 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -416,7 +416,7 @@ EXPORT_SYMBOL_GPL(inet_sk_diag_fill);
static int inet_twsk_diag_fill(struct sock *sk,
struct sk_buff *skb,
struct netlink_callback *cb,
- u16 nlmsg_flags)
+ u16 nlmsg_flags, bool net_admin)
{
struct inet_timewait_sock *tw = inet_twsk(sk);
struct inet_diag_msg *r;
@@ -444,6 +444,12 @@ static int inet_twsk_diag_fill(struct sock *sk,
r->idiag_uid = 0;
r->idiag_inode = 0;
+ if (net_admin && nla_put_u32(skb, INET_DIAG_MARK,
+ tw->tw_mark)) {
+ nlmsg_cancel(skb, nlh);
+ return -EMSGSIZE;
+ }
+
nlmsg_end(skb, nlh);
return 0;
}
@@ -494,7 +500,7 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
u16 nlmsg_flags, bool net_admin)
{
if (sk->sk_state == TCP_TIME_WAIT)
- return inet_twsk_diag_fill(sk, skb, cb, nlmsg_flags);
+ return inet_twsk_diag_fill(sk, skb, cb, nlmsg_flags, net_admin);
if (sk->sk_state == TCP_NEW_SYN_RECV)
return inet_req_diag_fill(sk, skb, cb, nlmsg_flags, net_admin);
@@ -801,6 +807,8 @@ int inet_diag_bc_sk(const struct nlattr *bc, struct sock *sk)
entry.mark = sk->sk_mark;
else if (sk->sk_state == TCP_NEW_SYN_RECV)
entry.mark = inet_rsk(inet_reqsk(sk))->ir_mark;
+ else if (sk->sk_state == TCP_TIME_WAIT)
+ entry.mark = inet_twsk(sk)->tw_mark;
else
entry.mark = 0;
#ifdef CONFIG_SOCK_CGROUP_DATA
--
2.32.0.272.g935e593368-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] inet_diag: add support for tw_mark
2021-06-16 6:06 [PATCH] inet_diag: add support for tw_mark Maciej Żenczykowski
@ 2021-06-16 6:18 ` Eric Dumazet
2021-06-16 6:40 ` Jonathan Maxwell
2021-06-16 7:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2021-06-16 6:18 UTC (permalink / raw)
To: Maciej Żenczykowski
Cc: Maciej Żenczykowski, Linux Network Development Mailing List,
David S . Miller, Hideaki YOSHIFUJI, David Ahern, Jakub Kicinski,
Jon Maxwell
On Wed, Jun 16, 2021 at 8:06 AM Maciej Żenczykowski
<zenczykowski@gmail.com> wrote:
>
> From: Maciej Żenczykowski <maze@google.com>
>
> Timewait sockets have included mark since approx 4.18.
>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Jon Maxwell <jmaxwell37@gmail.com>
> Fixes: 00483690552c ("tcp: Add mark for TIMEWAIT sockets")
> Signed-off-by: Maciej Żenczykowski <maze@google.com>
> ---
>
SGTM, thanks Maciej !
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] inet_diag: add support for tw_mark
2021-06-16 6:06 [PATCH] inet_diag: add support for tw_mark Maciej Żenczykowski
2021-06-16 6:18 ` Eric Dumazet
@ 2021-06-16 6:40 ` Jonathan Maxwell
2021-06-16 7:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Maxwell @ 2021-06-16 6:40 UTC (permalink / raw)
To: Maciej Żenczykowski
Cc: Maciej Żenczykowski, Linux Network Development Mailing List,
David S . Miller, Hideaki YOSHIFUJI, David Ahern, Jakub Kicinski,
Eric Dumazet
On Wed, Jun 16, 2021 at 4:06 PM Maciej Żenczykowski
<zenczykowski@gmail.com> wrote:
>
> From: Maciej Żenczykowski <maze@google.com>
>
> Timewait sockets have included mark since approx 4.18.
>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Jon Maxwell <jmaxwell37@gmail.com>
> Fixes: 00483690552c ("tcp: Add mark for TIMEWAIT sockets")
> Signed-off-by: Maciej Żenczykowski <maze@google.com>
> ---
> net/ipv4/inet_diag.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
> index 93474b1bea4e..e65f4ef024a4 100644
> --- a/net/ipv4/inet_diag.c
> +++ b/net/ipv4/inet_diag.c
> @@ -416,7 +416,7 @@ EXPORT_SYMBOL_GPL(inet_sk_diag_fill);
> static int inet_twsk_diag_fill(struct sock *sk,
> struct sk_buff *skb,
> struct netlink_callback *cb,
> - u16 nlmsg_flags)
> + u16 nlmsg_flags, bool net_admin)
> {
> struct inet_timewait_sock *tw = inet_twsk(sk);
> struct inet_diag_msg *r;
> @@ -444,6 +444,12 @@ static int inet_twsk_diag_fill(struct sock *sk,
> r->idiag_uid = 0;
> r->idiag_inode = 0;
>
> + if (net_admin && nla_put_u32(skb, INET_DIAG_MARK,
> + tw->tw_mark)) {
> + nlmsg_cancel(skb, nlh);
> + return -EMSGSIZE;
> + }
> +
> nlmsg_end(skb, nlh);
> return 0;
> }
> @@ -494,7 +500,7 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
> u16 nlmsg_flags, bool net_admin)
> {
> if (sk->sk_state == TCP_TIME_WAIT)
> - return inet_twsk_diag_fill(sk, skb, cb, nlmsg_flags);
> + return inet_twsk_diag_fill(sk, skb, cb, nlmsg_flags, net_admin);
>
> if (sk->sk_state == TCP_NEW_SYN_RECV)
> return inet_req_diag_fill(sk, skb, cb, nlmsg_flags, net_admin);
> @@ -801,6 +807,8 @@ int inet_diag_bc_sk(const struct nlattr *bc, struct sock *sk)
> entry.mark = sk->sk_mark;
> else if (sk->sk_state == TCP_NEW_SYN_RECV)
> entry.mark = inet_rsk(inet_reqsk(sk))->ir_mark;
> + else if (sk->sk_state == TCP_TIME_WAIT)
> + entry.mark = inet_twsk(sk)->tw_mark;
> else
> entry.mark = 0;
> #ifdef CONFIG_SOCK_CGROUP_DATA
> --
> 2.32.0.272.g935e593368-goog
>
Thanks for adding that to the inet_diag module.
Reviewed-by: Jon Maxwell <jmaxwell37@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] inet_diag: add support for tw_mark
2021-06-16 6:06 [PATCH] inet_diag: add support for tw_mark Maciej Żenczykowski
2021-06-16 6:18 ` Eric Dumazet
2021-06-16 6:40 ` Jonathan Maxwell
@ 2021-06-16 7:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-16 7:50 UTC (permalink / raw)
To: =?utf-8?q?Maciej_=C5=BBenczykowski_=3Czenczykowski=40gmail=2Ecom=3E?=
Cc: maze, netdev, davem, yoshfuji, dsahern, kuba, edumazet, jmaxwell37
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Tue, 15 Jun 2021 23:06:04 -0700 you wrote:
> From: Maciej Żenczykowski <maze@google.com>
>
> Timewait sockets have included mark since approx 4.18.
>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Jon Maxwell <jmaxwell37@gmail.com>
> Fixes: 00483690552c ("tcp: Add mark for TIMEWAIT sockets")
> Signed-off-by: Maciej Żenczykowski <maze@google.com>
>
> [...]
Here is the summary with links:
- inet_diag: add support for tw_mark
https://git.kernel.org/netdev/net-next/c/1b3fc771769c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-16 7:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 6:06 [PATCH] inet_diag: add support for tw_mark Maciej Żenczykowski
2021-06-16 6:18 ` Eric Dumazet
2021-06-16 6:40 ` Jonathan Maxwell
2021-06-16 7:50 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.