All of lore.kernel.org
 help / color / mirror / Atom feed
* [net v4] selftests: txtimestamp: fix compilation issue
@ 2021-02-04 17:50 Vadim Fedorenko
  2021-02-04 18:57 ` Willem de Bruijn
  2021-02-05  4:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Vadim Fedorenko @ 2021-02-04 17:50 UTC (permalink / raw)
  To: Jakub Kicinski, Jian Yang, Willem de Bruijn; +Cc: Vadim Fedorenko, netdev

PACKET_TX_TIMESTAMP is defined in if_packet.h but it is not included in
test. Include it instead of <netpacket/packet.h> otherwise the error of
redefinition arrives.
Also fix the compiler warning about ambiguous control flow by adding
explicit braces.

Fixes: 8fe2f761cae9 ("net-timestamp: expand documentation")
Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Signed-off-by: Vadim Fedorenko <vfedorenko@novek.ru>
---
 tools/testing/selftests/net/txtimestamp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/net/txtimestamp.c b/tools/testing/selftests/net/txtimestamp.c
index 490a8cc..fabb1d5 100644
--- a/tools/testing/selftests/net/txtimestamp.c
+++ b/tools/testing/selftests/net/txtimestamp.c
@@ -26,6 +26,7 @@
 #include <inttypes.h>
 #include <linux/errqueue.h>
 #include <linux/if_ether.h>
+#include <linux/if_packet.h>
 #include <linux/ipv6.h>
 #include <linux/net_tstamp.h>
 #include <netdb.h>
@@ -34,7 +35,6 @@
 #include <netinet/ip.h>
 #include <netinet/udp.h>
 #include <netinet/tcp.h>
-#include <netpacket/packet.h>
 #include <poll.h>
 #include <stdarg.h>
 #include <stdbool.h>
@@ -495,12 +495,12 @@ static void do_test(int family, unsigned int report_opt)
 	total_len = cfg_payload_len;
 	if (cfg_use_pf_packet || cfg_proto == SOCK_RAW) {
 		total_len += sizeof(struct udphdr);
-		if (cfg_use_pf_packet || cfg_ipproto == IPPROTO_RAW)
+		if (cfg_use_pf_packet || cfg_ipproto == IPPROTO_RAW) {
 			if (family == PF_INET)
 				total_len += sizeof(struct iphdr);
 			else
 				total_len += sizeof(struct ipv6hdr);
-
+		}
 		/* special case, only rawv6_sendmsg:
 		 * pass proto in sin6_port if not connected
 		 * also see ANK comment in net/ipv4/raw.c
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [net v4] selftests: txtimestamp: fix compilation issue
  2021-02-04 17:50 [net v4] selftests: txtimestamp: fix compilation issue Vadim Fedorenko
@ 2021-02-04 18:57 ` Willem de Bruijn
  2021-02-05  4:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2021-02-04 18:57 UTC (permalink / raw)
  To: Vadim Fedorenko; +Cc: Jakub Kicinski, Jian Yang, Network Development

On Thu, Feb 4, 2021 at 12:51 PM Vadim Fedorenko <vfedorenko@novek.ru> wrote:
>
> PACKET_TX_TIMESTAMP is defined in if_packet.h but it is not included in
> test. Include it instead of <netpacket/packet.h> otherwise the error of
> redefinition arrives.
> Also fix the compiler warning about ambiguous control flow by adding
> explicit braces.
>
> Fixes: 8fe2f761cae9 ("net-timestamp: expand documentation")
> Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Signed-off-by: Vadim Fedorenko <vfedorenko@novek.ru>

Acked-by: Willem de Bruijn <willemb@google.com>

Thanks for fixing this, Vadim.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [net v4] selftests: txtimestamp: fix compilation issue
  2021-02-04 17:50 [net v4] selftests: txtimestamp: fix compilation issue Vadim Fedorenko
  2021-02-04 18:57 ` Willem de Bruijn
@ 2021-02-05  4:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-02-05  4:40 UTC (permalink / raw)
  To: Vadim Fedorenko; +Cc: kuba, jianyang, willemdebruijn.kernel, netdev

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Thu,  4 Feb 2021 20:50:34 +0300 you wrote:
> PACKET_TX_TIMESTAMP is defined in if_packet.h but it is not included in
> test. Include it instead of <netpacket/packet.h> otherwise the error of
> redefinition arrives.
> Also fix the compiler warning about ambiguous control flow by adding
> explicit braces.
> 
> Fixes: 8fe2f761cae9 ("net-timestamp: expand documentation")
> Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Signed-off-by: Vadim Fedorenko <vfedorenko@novek.ru>
> 
> [...]

Here is the summary with links:
  - [net,v4] selftests: txtimestamp: fix compilation issue
    https://git.kernel.org/netdev/net/c/647b8dd51846

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] 3+ messages in thread

end of thread, other threads:[~2021-02-05  4:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 17:50 [net v4] selftests: txtimestamp: fix compilation issue Vadim Fedorenko
2021-02-04 18:57 ` Willem de Bruijn
2021-02-05  4:40 ` 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.