* [PATCH v3] net-netlink: Add a new attribute to expose TOS values via netlink [not found] <20111010145206.6f7e9ee2@nehalam.linuxnetplumber.net> @ 2011-10-12 1:28 ` Muraliraja Muniraju 2011-10-12 2:48 ` Eric Dumazet 2011-10-12 15:52 ` Stephen Hemminger 0 siblings, 2 replies; 10+ messages in thread From: Muraliraja Muniraju @ 2011-10-12 1:28 UTC (permalink / raw) To: David S. Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI, Patrick McHardy Cc: linux-kernel, netdev, Murali Raja From: Murali Raja <muralira@google.com> This patch exposes the tos value for the TCP sockets when the TOS flag is requested in the ext_flags for the inet_diag request. This would mainly be used to expose TOS values for both for TCP and UDP sockets. Currently it is supported for TCP. When netlink support for UDP would be added the support to expose the TOS values would alse be done. Signed-off-by: Murali Raja <muralira@google.com> --- Changelog since v2: - Adding support for IPV6 class and using right API's Changelog since v1: - Removing reserved field include/linux/inet_diag.h | 9 ++++++++- net/ipv4/inet_diag.c | 5 +++++ 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h index bc8c490..e36093d 100644 --- a/include/linux/inet_diag.h +++ b/include/linux/inet_diag.h @@ -97,9 +97,10 @@ enum { INET_DIAG_INFO, INET_DIAG_VEGASINFO, INET_DIAG_CONG, + INET_DIAG_TOS, }; -#define INET_DIAG_MAX INET_DIAG_CONG +#define INET_DIAG_MAX INET_DIAG_TOS /* INET_DIAG_MEM */ @@ -120,6 +121,12 @@ struct tcpvegas_info { __u32 tcpv_minrtt; }; +/* INET_DIAG_TOS */ + +struct inet_diag_tos { + __u8 idiag_tos; +}; + #ifdef __KERNEL__ struct sock; struct inet_hashinfo; diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 389a2e6..f5e2bda 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c @@ -108,6 +108,9 @@ static int inet_csk_diag_fill(struct sock *sk, icsk->icsk_ca_ops->name); } + if ((ext & (1 << (INET_DIAG_TOS - 1))) && (sk->sk_family != AF_INET6)) + RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos); + r->idiag_family = sk->sk_family; r->idiag_state = sk->sk_state; r->idiag_timer = 0; @@ -130,6 +133,8 @@ static int inet_csk_diag_fill(struct sock *sk, &np->rcv_saddr); ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, &np->daddr); + if (ext & (1 << (INET_DIAG_TOS - 1))) + RTA_PUT_U8(skb, INET_DIAG_TOS, np->tclass); } #endif -- 1.7.3.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3] net-netlink: Add a new attribute to expose TOS values via netlink 2011-10-12 1:28 ` [PATCH v3] net-netlink: Add a new attribute to expose TOS values via netlink Muraliraja Muniraju @ 2011-10-12 2:48 ` Eric Dumazet 2011-10-12 4:16 ` MuraliRaja Muniraju 2011-10-12 15:52 ` Stephen Hemminger 1 sibling, 1 reply; 10+ messages in thread From: Eric Dumazet @ 2011-10-12 2:48 UTC (permalink / raw) To: Muraliraja Muniraju Cc: David S. Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI, Patrick McHardy, linux-kernel, netdev Le mardi 11 octobre 2011 à 18:28 -0700, Muraliraja Muniraju a écrit : > From: Murali Raja <muralira@google.com> > > This patch exposes the tos value for the TCP sockets when the TOS flag > is requested in the ext_flags for the inet_diag request. This would mainly be > used to expose TOS values for both for TCP and UDP sockets. Currently it is > supported for TCP. When netlink support for UDP would be added the support > to expose the TOS values would alse be done. > You could mention TCLASS support for IPv6 > Signed-off-by: Murali Raja <muralira@google.com> > --- > Changelog since v2: > - Adding support for IPV6 class and using right API's > Changelog since v1: > - Removing reserved field > > include/linux/inet_diag.h | 9 ++++++++- > net/ipv4/inet_diag.c | 5 +++++ > 2 files changed, 13 insertions(+), 1 deletions(-) > > diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h > index bc8c490..e36093d 100644 > --- a/include/linux/inet_diag.h > +++ b/include/linux/inet_diag.h > @@ -97,9 +97,10 @@ enum { > INET_DIAG_INFO, > INET_DIAG_VEGASINFO, > INET_DIAG_CONG, > + INET_DIAG_TOS, > }; > > -#define INET_DIAG_MAX INET_DIAG_CONG > +#define INET_DIAG_MAX INET_DIAG_TOS > > > /* INET_DIAG_MEM */ > @@ -120,6 +121,12 @@ struct tcpvegas_info { > __u32 tcpv_minrtt; > }; > > +/* INET_DIAG_TOS */ > + > +struct inet_diag_tos { > + __u8 idiag_tos; > +}; Are you sure its still needed ? I am now wondering what is done in TIME_WAIT state. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] net-netlink: Add a new attribute to expose TOS values via netlink 2011-10-12 2:48 ` Eric Dumazet @ 2011-10-12 4:16 ` MuraliRaja Muniraju 2011-10-12 4:31 ` Eric Dumazet 0 siblings, 1 reply; 10+ messages in thread From: MuraliRaja Muniraju @ 2011-10-12 4:16 UTC (permalink / raw) To: Eric Dumazet Cc: David S. Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI, Patrick McHardy, linux-kernel, netdev Eric, I think it would be useful to expose the values this way. I shall make the changes to add TCLASS for ipv6 in the description. Regarding the TIME_WAIT state, I think it would be better of not exposing the values because there would hardly be anything to transmit during this time. Thanks, Murali On Tue, Oct 11, 2011 at 7:48 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote: > Le mardi 11 octobre 2011 à 18:28 -0700, Muraliraja Muniraju a écrit : >> From: Murali Raja <muralira@google.com> >> >> This patch exposes the tos value for the TCP sockets when the TOS flag >> is requested in the ext_flags for the inet_diag request. This would mainly be >> used to expose TOS values for both for TCP and UDP sockets. Currently it is >> supported for TCP. When netlink support for UDP would be added the support >> to expose the TOS values would alse be done. >> > > You could mention TCLASS support for IPv6 > >> Signed-off-by: Murali Raja <muralira@google.com> >> --- >> Changelog since v2: >> - Adding support for IPV6 class and using right API's >> Changelog since v1: >> - Removing reserved field >> >> include/linux/inet_diag.h | 9 ++++++++- >> net/ipv4/inet_diag.c | 5 +++++ >> 2 files changed, 13 insertions(+), 1 deletions(-) >> >> diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h >> index bc8c490..e36093d 100644 >> --- a/include/linux/inet_diag.h >> +++ b/include/linux/inet_diag.h >> @@ -97,9 +97,10 @@ enum { >> INET_DIAG_INFO, >> INET_DIAG_VEGASINFO, >> INET_DIAG_CONG, >> + INET_DIAG_TOS, >> }; >> >> -#define INET_DIAG_MAX INET_DIAG_CONG >> +#define INET_DIAG_MAX INET_DIAG_TOS >> >> >> /* INET_DIAG_MEM */ >> @@ -120,6 +121,12 @@ struct tcpvegas_info { >> __u32 tcpv_minrtt; >> }; >> >> +/* INET_DIAG_TOS */ >> + >> +struct inet_diag_tos { >> + __u8 idiag_tos; >> +}; > > Are you sure its still needed ? > > I am now wondering what is done in TIME_WAIT state. > > > -- Thanks, Murali ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] net-netlink: Add a new attribute to expose TOS values via netlink 2011-10-12 4:16 ` MuraliRaja Muniraju @ 2011-10-12 4:31 ` Eric Dumazet 2011-10-12 19:00 ` MuraliRaja Muniraju 0 siblings, 1 reply; 10+ messages in thread From: Eric Dumazet @ 2011-10-12 4:31 UTC (permalink / raw) To: MuraliRaja Muniraju Cc: David S. Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI, Patrick McHardy, linux-kernel, netdev Le mardi 11 octobre 2011 à 21:16 -0700, MuraliRaja Muniraju a écrit : > Eric, > I think it would be useful to expose the values this way. > I shall make the changes to add TCLASS for ipv6 in the description. > > Regarding the TIME_WAIT state, I think it would be better of not > exposing the values because there would hardly be anything to transmit > during this time. > My remark had nothing to do with your patch actually : We dont store TOS/TCLASS on TIME_WAIT sockets, so you cannot report value in inet_diag. But we do send packets on behalf of TIME_WAIT sockets ;) Think about ACK messages. They probably are sent with a 0 TOS/TCLASS field... I am not sure its a problem or not. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] net-netlink: Add a new attribute to expose TOS values via netlink 2011-10-12 4:31 ` Eric Dumazet @ 2011-10-12 19:00 ` MuraliRaja Muniraju 0 siblings, 0 replies; 10+ messages in thread From: MuraliRaja Muniraju @ 2011-10-12 19:00 UTC (permalink / raw) To: Eric Dumazet Cc: David S. Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI, Patrick McHardy, linux-kernel, netdev Hi Eric, I am planning to not add code for the TIME_WAIT case as the tos values are zero as they are not saved. Please let me if this is OK. Thanks, Murali On Tue, Oct 11, 2011 at 9:31 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote: > Le mardi 11 octobre 2011 à 21:16 -0700, MuraliRaja Muniraju a écrit : >> Eric, >> I think it would be useful to expose the values this way. >> I shall make the changes to add TCLASS for ipv6 in the description. >> >> Regarding the TIME_WAIT state, I think it would be better of not >> exposing the values because there would hardly be anything to transmit >> during this time. >> > > My remark had nothing to do with your patch actually : > > We dont store TOS/TCLASS on TIME_WAIT sockets, so you cannot report > value in inet_diag. > > But we do send packets on behalf of TIME_WAIT sockets ;) > > Think about ACK messages. They probably are sent with a 0 TOS/TCLASS > field... I am not sure its a problem or not. > > > > -- Thanks, Murali ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] net-netlink: Add a new attribute to expose TOS values via netlink 2011-10-12 1:28 ` [PATCH v3] net-netlink: Add a new attribute to expose TOS values via netlink Muraliraja Muniraju 2011-10-12 2:48 ` Eric Dumazet @ 2011-10-12 15:52 ` Stephen Hemminger 2011-10-12 19:00 ` [PATCH v4] " Muraliraja Muniraju 1 sibling, 1 reply; 10+ messages in thread From: Stephen Hemminger @ 2011-10-12 15:52 UTC (permalink / raw) To: Muraliraja Muniraju Cc: David S. Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI, Patrick McHardy, linux-kernel, netdev On Tue, 11 Oct 2011 18:28:07 -0700 Muraliraja Muniraju <muralira@google.com> wrote: > +/* INET_DIAG_TOS */ > + > +struct inet_diag_tos { > + __u8 idiag_tos; > +}; > + This structure is not used. ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v4] net-netlink: Add a new attribute to expose TOS values via netlink 2011-10-12 15:52 ` Stephen Hemminger @ 2011-10-12 19:00 ` Muraliraja Muniraju 2011-10-12 19:08 ` Stephen Hemminger 2011-10-12 19:15 ` Eric Dumazet 0 siblings, 2 replies; 10+ messages in thread From: Muraliraja Muniraju @ 2011-10-12 19:00 UTC (permalink / raw) To: David S. Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI, Patrick McHardy Cc: linux-kernel, netdev, Murali Raja From: Murali Raja <muralira@google.com> This patch exposes the tos value for the TCP sockets when the TOS flag is requested in the ext_flags for the inet_diag request. This would mainly be used to expose TOS values for both for TCP and UDP sockets. Currently it is supported for TCP. When netlink support for UDP would be added the support to expose the TOS values would alse be done. For IPV4 tos value is exposed and for IPV6 tclass value is exposed. Signed-off-by: Murali Raja <muralira@google.com> --- Changelog since v3: - Removed the tos structure from the inet_diag.h Changelog since v2: - Added support for IPv6 and used better API. Changelog since v3: - Removed reserved fields. include/linux/inet_diag.h | 3 ++- net/ipv4/inet_diag.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h index bc8c490..80b480c 100644 --- a/include/linux/inet_diag.h +++ b/include/linux/inet_diag.h @@ -97,9 +97,10 @@ enum { INET_DIAG_INFO, INET_DIAG_VEGASINFO, INET_DIAG_CONG, + INET_DIAG_TOS, }; -#define INET_DIAG_MAX INET_DIAG_CONG +#define INET_DIAG_MAX INET_DIAG_TOS /* INET_DIAG_MEM */ diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 389a2e6..f5e2bda 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c @@ -108,6 +108,9 @@ static int inet_csk_diag_fill(struct sock *sk, icsk->icsk_ca_ops->name); } + if ((ext & (1 << (INET_DIAG_TOS - 1))) && (sk->sk_family != AF_INET6)) + RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos); + r->idiag_family = sk->sk_family; r->idiag_state = sk->sk_state; r->idiag_timer = 0; @@ -130,6 +133,8 @@ static int inet_csk_diag_fill(struct sock *sk, &np->rcv_saddr); ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, &np->daddr); + if (ext & (1 << (INET_DIAG_TOS - 1))) + RTA_PUT_U8(skb, INET_DIAG_TOS, np->tclass); } #endif -- 1.7.3.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v4] net-netlink: Add a new attribute to expose TOS values via netlink 2011-10-12 19:00 ` [PATCH v4] " Muraliraja Muniraju @ 2011-10-12 19:08 ` Stephen Hemminger 2011-10-12 19:15 ` Eric Dumazet 1 sibling, 0 replies; 10+ messages in thread From: Stephen Hemminger @ 2011-10-12 19:08 UTC (permalink / raw) To: Muraliraja Muniraju Cc: David S. Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI, Patrick McHardy, linux-kernel, netdev On Wed, 12 Oct 2011 12:00:35 -0700 Muraliraja Muniraju <muralira@google.com> wrote: > From: Murali Raja <muralira@google.com> > > This patch exposes the tos value for the TCP sockets when the TOS flag > is requested in the ext_flags for the inet_diag request. This would mainly be > used to expose TOS values for both for TCP and UDP sockets. Currently it is > supported for TCP. When netlink support for UDP would be added the support > to expose the TOS values would alse be done. For IPV4 tos value is exposed > and for IPV6 tclass value is exposed. > > Signed-off-by: Murali Raja <muralira@google.com> > --- > Changelog since v3: > - Removed the tos structure from the inet_diag.h > > Changelog since v2: > - Added support for IPv6 and used better API. > > Changelog since v3: > - Removed reserved fields. After this is accepted; it is trivial to add support to ss command. Acked-by: Stephen Hemminger <shemminger@vyatta.com> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v4] net-netlink: Add a new attribute to expose TOS values via netlink 2011-10-12 19:00 ` [PATCH v4] " Muraliraja Muniraju 2011-10-12 19:08 ` Stephen Hemminger @ 2011-10-12 19:15 ` Eric Dumazet 2011-10-12 23:10 ` David Miller 1 sibling, 1 reply; 10+ messages in thread From: Eric Dumazet @ 2011-10-12 19:15 UTC (permalink / raw) To: Muraliraja Muniraju Cc: David S. Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI, Patrick McHardy, linux-kernel, netdev Le mercredi 12 octobre 2011 à 12:00 -0700, Muraliraja Muniraju a écrit : > From: Murali Raja <muralira@google.com> > > This patch exposes the tos value for the TCP sockets when the TOS flag > is requested in the ext_flags for the inet_diag request. This would mainly be > used to expose TOS values for both for TCP and UDP sockets. Currently it is > supported for TCP. When netlink support for UDP would be added the support > to expose the TOS values would alse be done. For IPV4 tos value is exposed > and for IPV6 tclass value is exposed. > > Signed-off-by: Murali Raja <muralira@google.com> > --- Acked-by: Eric Dumazet <eric.dumazet@gmail.com> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v4] net-netlink: Add a new attribute to expose TOS values via netlink 2011-10-12 19:15 ` Eric Dumazet @ 2011-10-12 23:10 ` David Miller 0 siblings, 0 replies; 10+ messages in thread From: David Miller @ 2011-10-12 23:10 UTC (permalink / raw) To: eric.dumazet Cc: muralira, kuznet, jmorris, yoshfuji, kaber, linux-kernel, netdev From: Eric Dumazet <eric.dumazet@gmail.com> Date: Wed, 12 Oct 2011 21:15:34 +0200 > Le mercredi 12 octobre 2011 à 12:00 -0700, Muraliraja Muniraju a écrit : >> From: Murali Raja <muralira@google.com> >> >> This patch exposes the tos value for the TCP sockets when the TOS flag >> is requested in the ext_flags for the inet_diag request. This would mainly be >> used to expose TOS values for both for TCP and UDP sockets. Currently it is >> supported for TCP. When netlink support for UDP would be added the support >> to expose the TOS values would alse be done. For IPV4 tos value is exposed >> and for IPV6 tclass value is exposed. >> >> Signed-off-by: Murali Raja <muralira@google.com> >> --- > > Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Applied, thanks everyone. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-10-12 23:13 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20111010145206.6f7e9ee2@nehalam.linuxnetplumber.net>
2011-10-12 1:28 ` [PATCH v3] net-netlink: Add a new attribute to expose TOS values via netlink Muraliraja Muniraju
2011-10-12 2:48 ` Eric Dumazet
2011-10-12 4:16 ` MuraliRaja Muniraju
2011-10-12 4:31 ` Eric Dumazet
2011-10-12 19:00 ` MuraliRaja Muniraju
2011-10-12 15:52 ` Stephen Hemminger
2011-10-12 19:00 ` [PATCH v4] " Muraliraja Muniraju
2011-10-12 19:08 ` Stephen Hemminger
2011-10-12 19:15 ` Eric Dumazet
2011-10-12 23: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