* [PATCH net-next] ip: expose inet sockopts through inet_diag
@ 2020-09-01 22:10 Wei Wang
2020-09-03 22:17 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Wei Wang @ 2020-09-01 22:10 UTC (permalink / raw)
To: David S . Miller, netdev; +Cc: Wei Wang, Eric Dumazet, Mahesh Bandewar
Expose all exisiting inet sockopt bits through inet_diag for debug purpose.
Corresponding changes in iproute2 ss will be submitted to output all
these values.
Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
include/linux/inet_diag.h | 2 ++
include/uapi/linux/inet_diag.h | 18 ++++++++++++++++++
net/ipv4/inet_diag.c | 17 +++++++++++++++++
3 files changed, 37 insertions(+)
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index 0ef2d800fda7..84abb30a3fbb 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -75,6 +75,8 @@ static inline size_t inet_diag_msg_attrs_size(void)
#ifdef CONFIG_SOCK_CGROUP_DATA
+ nla_total_size_64bit(sizeof(u64)) /* INET_DIAG_CGROUP_ID */
#endif
+ + nla_total_size(sizeof(struct inet_diag_sockopt))
+ /* INET_DIAG_SOCKOPT */
;
}
int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h
index 5ba122c1949a..20ee93f0f876 100644
--- a/include/uapi/linux/inet_diag.h
+++ b/include/uapi/linux/inet_diag.h
@@ -160,6 +160,7 @@ enum {
INET_DIAG_ULP_INFO,
INET_DIAG_SK_BPF_STORAGES,
INET_DIAG_CGROUP_ID,
+ INET_DIAG_SOCKOPT,
__INET_DIAG_MAX,
};
@@ -183,6 +184,23 @@ struct inet_diag_meminfo {
__u32 idiag_tmem;
};
+/* INET_DIAG_SOCKOPT */
+
+struct inet_diag_sockopt {
+ __u8 recverr:1,
+ is_icsk:1,
+ freebind:1,
+ hdrincl:1,
+ mc_loop:1,
+ transparent:1,
+ mc_all:1,
+ nodefrag:1;
+ __u8 bind_address_no_port:1,
+ recverr_rfc4884:1,
+ defer_connect:1,
+ unused:5;
+};
+
/* INET_DIAG_VEGASINFO */
struct tcpvegas_info {
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 4a98dd736270..93816d47e55a 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -125,6 +125,7 @@ int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
bool net_admin)
{
const struct inet_sock *inet = inet_sk(sk);
+ struct inet_diag_sockopt inet_sockopt;
if (nla_put_u8(skb, INET_DIAG_SHUTDOWN, sk->sk_shutdown))
goto errout;
@@ -180,6 +181,22 @@ int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
r->idiag_uid = from_kuid_munged(user_ns, sock_i_uid(sk));
r->idiag_inode = sock_i_ino(sk);
+ memset(&inet_sockopt, 0, sizeof(inet_sockopt));
+ inet_sockopt.recverr = inet->recverr;
+ inet_sockopt.is_icsk = inet->is_icsk;
+ inet_sockopt.freebind = inet->freebind;
+ inet_sockopt.hdrincl = inet->hdrincl;
+ inet_sockopt.mc_loop = inet->mc_loop;
+ inet_sockopt.transparent = inet->transparent;
+ inet_sockopt.mc_all = inet->mc_all;
+ inet_sockopt.nodefrag = inet->nodefrag;
+ inet_sockopt.bind_address_no_port = inet->bind_address_no_port;
+ inet_sockopt.recverr_rfc4884 = inet->recverr_rfc4884;
+ inet_sockopt.defer_connect = inet->defer_connect;
+ if (nla_put(skb, INET_DIAG_SOCKOPT, sizeof(inet_sockopt),
+ &inet_sockopt))
+ goto errout;
+
return 0;
errout:
return 1;
--
2.28.0.402.g5ffc5be6b7-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] ip: expose inet sockopts through inet_diag
2020-09-01 22:10 [PATCH net-next] ip: expose inet sockopts through inet_diag Wei Wang
@ 2020-09-03 22:17 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2020-09-03 22:17 UTC (permalink / raw)
To: weiwan; +Cc: netdev, edumazet, maheshb
From: Wei Wang <weiwan@google.com>
Date: Tue, 1 Sep 2020 15:10:08 -0700
> Expose all exisiting inet sockopt bits through inet_diag for debug purpose.
> Corresponding changes in iproute2 ss will be submitted to output all
> these values.
>
> Signed-off-by: Wei Wang <weiwan@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] ip: expose inet sockopts through inet_diag
2020-09-01 18:19 ` Wei Wang
@ 2020-09-01 19:10 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2020-09-01 19:10 UTC (permalink / raw)
To: weiwan; +Cc: netdev, edumazet, maheshb
From: Wei Wang <weiwan@google.com>
Date: Tue, 1 Sep 2020 11:19:45 -0700
> This patch was sent ~2 weeks ago (after net-next opened) and I have
> not heard any feedback on this.
> In patchwork:
> https://patchwork.ozlabs.org/project/netdev/patch/20200818231356.1811759-1-weiwan@google.com/
> The status shows "Changes Requested", which I am not sure why.
> Could you please advise?
Sorry about that, please resubmit.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] ip: expose inet sockopts through inet_diag
2020-08-18 23:13 Wei Wang
@ 2020-09-01 18:19 ` Wei Wang
2020-09-01 19:10 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Wei Wang @ 2020-09-01 18:19 UTC (permalink / raw)
To: David Miller, Linux Kernel Network Developers
Cc: Eric Dumazet, Mahesh Bandewar
On Tue, Aug 18, 2020 at 4:14 PM Wei Wang <weiwan@google.com> wrote:
>
> Expose all exisiting inet sockopt bits through inet_diag for debug purpose.
> Corresponding changes in iproute2 ss will be submitted to output all
> these values.
>
> Signed-off-by: Wei Wang <weiwan@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
> ---
Hi David,
This patch was sent ~2 weeks ago (after net-next opened) and I have
not heard any feedback on this.
In patchwork:
https://patchwork.ozlabs.org/project/netdev/patch/20200818231356.1811759-1-weiwan@google.com/
The status shows "Changes Requested", which I am not sure why.
Could you please advise?
Thanks so much.
Wei
> include/linux/inet_diag.h | 2 ++
> include/uapi/linux/inet_diag.h | 18 ++++++++++++++++++
> net/ipv4/inet_diag.c | 17 +++++++++++++++++
> 3 files changed, 37 insertions(+)
>
> diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
> index 0ef2d800fda7..84abb30a3fbb 100644
> --- a/include/linux/inet_diag.h
> +++ b/include/linux/inet_diag.h
> @@ -75,6 +75,8 @@ static inline size_t inet_diag_msg_attrs_size(void)
> #ifdef CONFIG_SOCK_CGROUP_DATA
> + nla_total_size_64bit(sizeof(u64)) /* INET_DIAG_CGROUP_ID */
> #endif
> + + nla_total_size(sizeof(struct inet_diag_sockopt))
> + /* INET_DIAG_SOCKOPT */
> ;
> }
> int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
> diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h
> index 5ba122c1949a..20ee93f0f876 100644
> --- a/include/uapi/linux/inet_diag.h
> +++ b/include/uapi/linux/inet_diag.h
> @@ -160,6 +160,7 @@ enum {
> INET_DIAG_ULP_INFO,
> INET_DIAG_SK_BPF_STORAGES,
> INET_DIAG_CGROUP_ID,
> + INET_DIAG_SOCKOPT,
> __INET_DIAG_MAX,
> };
>
> @@ -183,6 +184,23 @@ struct inet_diag_meminfo {
> __u32 idiag_tmem;
> };
>
> +/* INET_DIAG_SOCKOPT */
> +
> +struct inet_diag_sockopt {
> + __u8 recverr:1,
> + is_icsk:1,
> + freebind:1,
> + hdrincl:1,
> + mc_loop:1,
> + transparent:1,
> + mc_all:1,
> + nodefrag:1;
> + __u8 bind_address_no_port:1,
> + recverr_rfc4884:1,
> + defer_connect:1,
> + unused:5;
> +};
> +
> /* INET_DIAG_VEGASINFO */
>
> struct tcpvegas_info {
> diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
> index 4a98dd736270..93816d47e55a 100644
> --- a/net/ipv4/inet_diag.c
> +++ b/net/ipv4/inet_diag.c
> @@ -125,6 +125,7 @@ int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
> bool net_admin)
> {
> const struct inet_sock *inet = inet_sk(sk);
> + struct inet_diag_sockopt inet_sockopt;
>
> if (nla_put_u8(skb, INET_DIAG_SHUTDOWN, sk->sk_shutdown))
> goto errout;
> @@ -180,6 +181,22 @@ int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
> r->idiag_uid = from_kuid_munged(user_ns, sock_i_uid(sk));
> r->idiag_inode = sock_i_ino(sk);
>
> + memset(&inet_sockopt, 0, sizeof(inet_sockopt));
> + inet_sockopt.recverr = inet->recverr;
> + inet_sockopt.is_icsk = inet->is_icsk;
> + inet_sockopt.freebind = inet->freebind;
> + inet_sockopt.hdrincl = inet->hdrincl;
> + inet_sockopt.mc_loop = inet->mc_loop;
> + inet_sockopt.transparent = inet->transparent;
> + inet_sockopt.mc_all = inet->mc_all;
> + inet_sockopt.nodefrag = inet->nodefrag;
> + inet_sockopt.bind_address_no_port = inet->bind_address_no_port;
> + inet_sockopt.recverr_rfc4884 = inet->recverr_rfc4884;
> + inet_sockopt.defer_connect = inet->defer_connect;
> + if (nla_put(skb, INET_DIAG_SOCKOPT, sizeof(inet_sockopt),
> + &inet_sockopt))
> + goto errout;
> +
> return 0;
> errout:
> return 1;
> --
> 2.28.0.297.g1956fa8f8d-goog
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next] ip: expose inet sockopts through inet_diag
@ 2020-08-18 23:13 Wei Wang
2020-09-01 18:19 ` Wei Wang
0 siblings, 1 reply; 5+ messages in thread
From: Wei Wang @ 2020-08-18 23:13 UTC (permalink / raw)
To: David Miller, netdev; +Cc: Eric Dumazet, Wei Wang, Mahesh Bandewar
Expose all exisiting inet sockopt bits through inet_diag for debug purpose.
Corresponding changes in iproute2 ss will be submitted to output all
these values.
Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
include/linux/inet_diag.h | 2 ++
include/uapi/linux/inet_diag.h | 18 ++++++++++++++++++
net/ipv4/inet_diag.c | 17 +++++++++++++++++
3 files changed, 37 insertions(+)
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index 0ef2d800fda7..84abb30a3fbb 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -75,6 +75,8 @@ static inline size_t inet_diag_msg_attrs_size(void)
#ifdef CONFIG_SOCK_CGROUP_DATA
+ nla_total_size_64bit(sizeof(u64)) /* INET_DIAG_CGROUP_ID */
#endif
+ + nla_total_size(sizeof(struct inet_diag_sockopt))
+ /* INET_DIAG_SOCKOPT */
;
}
int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h
index 5ba122c1949a..20ee93f0f876 100644
--- a/include/uapi/linux/inet_diag.h
+++ b/include/uapi/linux/inet_diag.h
@@ -160,6 +160,7 @@ enum {
INET_DIAG_ULP_INFO,
INET_DIAG_SK_BPF_STORAGES,
INET_DIAG_CGROUP_ID,
+ INET_DIAG_SOCKOPT,
__INET_DIAG_MAX,
};
@@ -183,6 +184,23 @@ struct inet_diag_meminfo {
__u32 idiag_tmem;
};
+/* INET_DIAG_SOCKOPT */
+
+struct inet_diag_sockopt {
+ __u8 recverr:1,
+ is_icsk:1,
+ freebind:1,
+ hdrincl:1,
+ mc_loop:1,
+ transparent:1,
+ mc_all:1,
+ nodefrag:1;
+ __u8 bind_address_no_port:1,
+ recverr_rfc4884:1,
+ defer_connect:1,
+ unused:5;
+};
+
/* INET_DIAG_VEGASINFO */
struct tcpvegas_info {
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 4a98dd736270..93816d47e55a 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -125,6 +125,7 @@ int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
bool net_admin)
{
const struct inet_sock *inet = inet_sk(sk);
+ struct inet_diag_sockopt inet_sockopt;
if (nla_put_u8(skb, INET_DIAG_SHUTDOWN, sk->sk_shutdown))
goto errout;
@@ -180,6 +181,22 @@ int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
r->idiag_uid = from_kuid_munged(user_ns, sock_i_uid(sk));
r->idiag_inode = sock_i_ino(sk);
+ memset(&inet_sockopt, 0, sizeof(inet_sockopt));
+ inet_sockopt.recverr = inet->recverr;
+ inet_sockopt.is_icsk = inet->is_icsk;
+ inet_sockopt.freebind = inet->freebind;
+ inet_sockopt.hdrincl = inet->hdrincl;
+ inet_sockopt.mc_loop = inet->mc_loop;
+ inet_sockopt.transparent = inet->transparent;
+ inet_sockopt.mc_all = inet->mc_all;
+ inet_sockopt.nodefrag = inet->nodefrag;
+ inet_sockopt.bind_address_no_port = inet->bind_address_no_port;
+ inet_sockopt.recverr_rfc4884 = inet->recverr_rfc4884;
+ inet_sockopt.defer_connect = inet->defer_connect;
+ if (nla_put(skb, INET_DIAG_SOCKOPT, sizeof(inet_sockopt),
+ &inet_sockopt))
+ goto errout;
+
return 0;
errout:
return 1;
--
2.28.0.297.g1956fa8f8d-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-03 22:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 22:10 [PATCH net-next] ip: expose inet sockopts through inet_diag Wei Wang
2020-09-03 22:17 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2020-08-18 23:13 Wei Wang
2020-09-01 18:19 ` Wei Wang
2020-09-01 19:10 ` David 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).