lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Florian Walbroel <walbroel@silexica.com>
Cc: Julien Desfossez <ju@klipix.org>, lttng-dev <lttng-dev@lists.lttng.org>
Subject: Re: [PATCH lttng-modules] Add UDP and ICMP packet header information to the tracepoint:
Date: Mon, 9 Mar 2020 11:28:01 -0400 (EDT)	[thread overview]
Message-ID: <1568442012.21567.1583767681155.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <20191113163814.31606-1-walbroel@silexica.com>

----- On Nov 13, 2019, at 11:38 AM, Florian Walbroel walbroel@silexica.com wrote:

> * UDP transport header
> * ICMP transport header
> 
> (Correct indentation for switch/case)

Hi Florian,

Please address the additional comments below,

[...]
> 
> +static inline enum transport_header_types __get_transport_header_type_ip(struct
> sk_buff *skb)
> +{
> +	switch(ip_hdr(skb)->protocol) {

this should be:

  switch (ip_hdr(skb)->protocol) {

> +	case IPPROTO_TCP:
> +		return TH_TCP;
> +	case IPPROTO_UDP:
> +		return TH_UDP;
> +	case IPPROTO_ICMP:
> +		return TH_ICMP;
> +	}
> +	return TH_NONE;
> +}
> +
> +static inline enum transport_header_types
> __get_transport_header_type_ipv6(struct sk_buff *skb)
> +{
> +	switch(ipv6_hdr(skb)->nexthdr) {

And this:

  switch (ipv6_hdr(skb)->nexthdr) {

> +	case IPPROTO_TCP:
> +		return TH_TCP;
> +	case IPPROTO_UDP:
> +		return TH_UDP;
> +	case IPPROTO_ICMP:
> +		return TH_ICMP;
> +	}
> +	return TH_NONE;
> +}
> +

[...]


> 
> static const struct lttng_enum_desc transport_header_type = {
> @@ -510,15 +633,32 @@ LTTNG_TRACEPOINT_EVENT_CLASS(net_dev_template,
> 					ctf_integer_type(unsigned char, th_type)
> 
> 					/* Copy the transport header. */
> -					if (th_type == TH_TCP) {
> +					switch (th_type) {
> +					case TH_TCP: {
> 						ctf_align(uint32_t)
> 						ctf_array_type(uint8_t, tcp_hdr(skb),
> 								sizeof(struct tcphdr))
> +						break;
> +					}
> +					case TH_UDP: {
> +						ctf_align(uint32_t)
> +						ctf_array_type(uint8_t, udp_hdr(skb),
> +								sizeof(struct udphdr))
> +						break;
> +					}
> +					case TH_ICMP: {
> +						ctf_align(uint32_t)
> +						ctf_array_type(uint8_t, icmp_hdr(skb),
> +								sizeof(struct udphdr))
> +						break;

Shouldn't this be "sizeof(struct icmphdr)" ?

By looking at their definitions they appear to be the same size by chance,
but it's good to have the right type here.

After a last respin of the patch, we should be good to merge.

Thanks,

Mathieu


> +					}
> +					default:
> +						/*
> +						* For any other transport header type,
> +						* there is nothing to do.
> +						*/
> +						break;
> 					}
> -					/*
> -					 * For any other transport header type,
> -					 * there is nothing to do.
> -					 */
> 				}
> 			)
> 		)

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

  parent reply	other threads:[~2020-03-09 15:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191113163814.31606-1-walbroel@silexica.com>
2019-12-17  8:56 ` Fwd: [PATCH lttng-modules] Add UDP and ICMP packet header information to the tracepoint: Florian Walbroel
     [not found] ` <7b697030-2d01-90bf-0225-fe52b42e9cd0@silexica.com>
2019-12-17 14:39   ` Mathieu Desnoyers
     [not found]   ` <1666401048.8323.1576593591017.JavaMail.zimbra@efficios.com>
2019-12-17 17:20     ` Michael Jeanson
     [not found]     ` <88c1b057-e920-433e-77b0-03dd04cd14de@efficios.com>
2020-03-09 10:55       ` Florian Walbroel
2020-03-09 15:28 ` Mathieu Desnoyers [this message]
2020-03-17  9:03 Florian Walbroel via lttng-dev
2020-03-17 15:19 ` Mathieu Desnoyers via lttng-dev
  -- strict thread matches above, loose matches on Subject: below --
2020-03-13 11:32 Florian Walbroel via lttng-dev
2020-03-16 15:15 ` Mathieu Desnoyers via lttng-dev
2019-11-13 16:38 Florian Walbroel
     [not found] <20191113090849.8784-1-walbroel@silexica.com>
2019-11-13 15:58 ` Mathieu Desnoyers
2019-11-13  9:08 Florian Walbroel
     [not found] <20191112163919.28628-1-walbroel@silexica.com>
2019-11-12 17:04 ` Mathieu Desnoyers
2019-11-12 16:39 Florian Walbroel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1568442012.21567.1583767681155.JavaMail.zimbra@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=ju@klipix.org \
    --cc=lttng-dev@lists.lttng.org \
    --cc=walbroel@silexica.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).