From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Subject: [PATCH] qrap: Add a neighbour solicitation to probe frames, instead of just ARP
Date: Wed, 20 Jul 2022 18:25:59 +0200 [thread overview]
Message-ID: <20220720162559.1308747-1-sbrivio@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2233 bytes --]
For a while now, passt disables ARP functionality completely if IPv4
is disabled. If qrap sends an ARP request as a probe in that case, it
will receive no answer and move on, trying to find another instance.
Add a second probe frame, a hardcoded neighbour solicitation, so that
we get a neighbour advertisement if IPv6 is enabled.
Without this change, IPv6-only operation is completely broken.
Reported-by: Wenli Quan <wquan(a)redhat.com>
Reported-by: Alona Paz <alkaplan(a)redhat.com>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2106257
Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>
---
qrap.c | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/qrap.c b/qrap.c
index d73cf6c..da96b22 100644
--- a/qrap.c
+++ b/qrap.c
@@ -24,9 +24,12 @@
#include <fcntl.h>
#include <net/if_arp.h>
#include <netinet/in.h>
+#include <netinet/ip6.h>
#include <netinet/if_ether.h>
#include <time.h>
+#include <linux/icmpv6.h>
+
#include "util.h"
#include "passt.h"
#include "arp.h"
@@ -121,12 +124,18 @@ int main(int argc, char **argv)
const struct pci_dev *dev = NULL;
long fd;
struct {
- uint32_t vnet_len;
- struct ethhdr eh;
+ uint32_t vnet_len4;
+ struct ethhdr eh4;
struct arphdr ah;
struct arpmsg am;
- } probe = {
- .vnet_len = htonl(42),
+
+ uint32_t vnet_len6;
+ struct ethhdr eh6;
+ struct ipv6hdr ip6hr;
+ struct icmp6hdr ihr;
+ struct in6_addr target;
+ } __attribute__((__packed__)) probe = {
+ .vnet_len4 = htonl(42),
{
.h_dest = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
.h_source = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
@@ -141,6 +150,25 @@ int main(int argc, char **argv)
{
.sha = { 0 }, .sip = { 0 }, .tha = { 0 }, .tip = { 0 },
},
+ .vnet_len6 = htonl(78),
+ {
+ .h_dest = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
+ .h_source = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
+ .h_proto = htons(ETH_P_IPV6),
+ },
+ {
+ .version = 6,
+ .payload_len = htons(24),
+ .nexthdr = IPPROTO_ICMPV6,
+ .hop_limit = 255,
+ .saddr = IN6ADDR_LOOPBACK_INIT,
+ .daddr = IN6ADDR_ANY_INIT,
+ },
+ {
+ .icmp6_type = 135,
+ .icmp6_code = 0,
+ },
+ IN6ADDR_ANY_INIT,
};
char probe_r;
--
@@ -24,9 +24,12 @@
#include <fcntl.h>
#include <net/if_arp.h>
#include <netinet/in.h>
+#include <netinet/ip6.h>
#include <netinet/if_ether.h>
#include <time.h>
+#include <linux/icmpv6.h>
+
#include "util.h"
#include "passt.h"
#include "arp.h"
@@ -121,12 +124,18 @@ int main(int argc, char **argv)
const struct pci_dev *dev = NULL;
long fd;
struct {
- uint32_t vnet_len;
- struct ethhdr eh;
+ uint32_t vnet_len4;
+ struct ethhdr eh4;
struct arphdr ah;
struct arpmsg am;
- } probe = {
- .vnet_len = htonl(42),
+
+ uint32_t vnet_len6;
+ struct ethhdr eh6;
+ struct ipv6hdr ip6hr;
+ struct icmp6hdr ihr;
+ struct in6_addr target;
+ } __attribute__((__packed__)) probe = {
+ .vnet_len4 = htonl(42),
{
.h_dest = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
.h_source = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
@@ -141,6 +150,25 @@ int main(int argc, char **argv)
{
.sha = { 0 }, .sip = { 0 }, .tha = { 0 }, .tip = { 0 },
},
+ .vnet_len6 = htonl(78),
+ {
+ .h_dest = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
+ .h_source = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
+ .h_proto = htons(ETH_P_IPV6),
+ },
+ {
+ .version = 6,
+ .payload_len = htons(24),
+ .nexthdr = IPPROTO_ICMPV6,
+ .hop_limit = 255,
+ .saddr = IN6ADDR_LOOPBACK_INIT,
+ .daddr = IN6ADDR_ANY_INIT,
+ },
+ {
+ .icmp6_type = 135,
+ .icmp6_code = 0,
+ },
+ IN6ADDR_ANY_INIT,
};
char probe_r;
--
2.35.1
reply other threads:[~2022-07-20 16:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220720162559.1308747-1-sbrivio@redhat.com \
--to=sbrivio@redhat.com \
--cc=passt-dev@passt.top \
/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.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
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 IMAP folder(s).