From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cyRSnBYV; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 0EA545A0275 for ; Tue, 30 Sep 2025 23:29:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1759267777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hEKCBt5yttvHDRxqWhQUKh+S4Z6w/HduEE4nJf/Ll4M=; b=cyRSnBYVOVKvD4HJ0WjX0Mu03yrfTgwOAnXanrNnAXRN5O4BB21D20dtrhMPQg0r4hHrvN h3u/MupGBIBZ7ZVeJBSsu/8J8vXQMVI1dRHizbwmYAmxNXUdBrjpyHuUFu4uWuEk3K1zgI iLVcYnU6eiopAtx+v+rvdMWfx/B9Eo0= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-168-VUKUhoEIP-ysVEwmZPRRYg-1; Tue, 30 Sep 2025 17:29:35 -0400 X-MC-Unique: VUKUhoEIP-ysVEwmZPRRYg-1 X-Mimecast-MFC-AGG-ID: VUKUhoEIP-ysVEwmZPRRYg_1759267774 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-46e35baddc1so40134145e9.2 for ; Tue, 30 Sep 2025 14:29:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759267774; x=1759872574; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=PsoeXo+OQ7x6kp8FWEQHUl1n4WKhEL/+BI5wgcm/7SA=; b=wSknuWhho6eCX2DZGS6bmzGMws/tISwtaVCu3KTsG3aqI7rYjVFX1XIdvkzDKTggV1 InNnxNHPSP+JuIwsrHkBhY1k4gcKhVqOaXv0bJ3VGegVFbGVA19MByqXPmzgx/3a5uv6 3Yt9u2wfdgmHSK9O9X4qFeqv1Y6Fc/z7XhV77gncuoMtPRj68iSfP1G9/NOK4ofgozQP ByWRseolbaboCRJa7wgmeRTUgmTIvv/a2wa6dIYNpT3kI71hUg5BfZVGrtCuv9yq5dQO aGN7y3kAxUOMSUUXI6K89bo2iri/triO/16TxtZdYsDABhpFDz+agxF3G+sz3OzbDhY3 SoSw== X-Forwarded-Encrypted: i=1; AJvYcCXS7gBD8BA8YXEVb04zeAXM9US9mGVn+1o/HCMayWLB/E6TZUf0eiQObP+C1bz3E3qBKx3NMjfuL/0=@passt.top X-Gm-Message-State: AOJu0YxWV2Pub0Jpy7X5k18uhXk6uI2sq3qi5nV22FsSZSROw+xDW2k/ gE+qiKpdXtkP/ZeqcNMEOyuGssViMb1Me066I/TM1acQev0f2YBkfie4767ITgzIVZ311vA+hip LGHHKWhe1NiDqaCE4jMN5uOIv6HR0fHRvQJ8luaxtjFbrHPLw29wVzw== X-Gm-Gg: ASbGncsxMNjhHBFnHtTBVawnZJm07e1hBEx5VGRNCLuuIzFQbkkhEUfJuwxktDCPoiE YHbtrmtvpJGh1fliTJK3aaKY/9AWJ5YXQF3xqrGf5icfIT3oNQMfO1gpclKeuVCsi9uHcMomq9/ H3nPULgaiMvtwycEI+hoAh1v0MJ1No4nO6S5unrhYZeQbonbI6cl+RPBwkxjigH7XihXi9938bc vqyYEvgsJrb3ewCac9mhsUyGe4NkCTBs9RvRKLYmWslNUaZgzOdj2KWv1j7SVgupgIzOjiwb6Xp QXglhPUZ4LOK1+Rtb+uGUq0cg7l5SdoTccWP7Jzb6etP5+V5/fF/AdBY X-Received: by 2002:a05:600c:3f0e:b0:46d:8406:2a76 with SMTP id 5b1f17b1804b1-46e61293fa6mr8648955e9.34.1759267774271; Tue, 30 Sep 2025 14:29:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF86RI7w24PcHseSdotGsrTeQxffKiiWvDjoIfgXZB8BlN7tzZsnrC17CpuJdwBocvk6FV+oQ== X-Received: by 2002:a05:600c:3f0e:b0:46d:8406:2a76 with SMTP id 5b1f17b1804b1-46e61293fa6mr8648805e9.34.1759267773857; Tue, 30 Sep 2025 14:29:33 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-40fb8811946sm24071832f8f.18.2025.09.30.14.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Sep 2025 14:29:33 -0700 (PDT) Date: Tue, 30 Sep 2025 23:29:32 +0200 From: Stefano Brivio To: Jon Maloy Subject: Re: [PATCH v11 5/9] flow: add MAC address of LAN local remote hosts to flow Message-ID: <20250930232932.4e7a2902@elisabeth> In-Reply-To: <20250927192522.3024554-6-jmaloy@redhat.com> References: <20250927192522.3024554-1-jmaloy@redhat.com> <20250927192522.3024554-6-jmaloy@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: eGdu5MTvOxT7k-EPMLQYguHEMZ89ZcMpfcBu_B-vqMQ_1759267774 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IY7ACTPEU5YLEIARVNCIJYY6XR27X6DP X-Message-ID-Hash: IY7ACTPEU5YLEIARVNCIJYY6XR27X6DP X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: dgibson@redhat.com, david@gibson.dropbear.id.au, passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Sat, 27 Sep 2025 15:25:18 -0400 Jon Maloy wrote: > When communicating with remote hosts on the local network, some guest > applications want to see the real MAC address of that host instead > of PASST/PASTA's own tap address. The flow_common structure is a > convenient location for storing that address, so we do that in this > commit. >=20 > Note that we don=C2=B4t add actual usage of this address here, that will > be done in later commits. >=20 > Signed-off-by: Jon Maloy > Reviewed-by: David Gibson >=20 > --- > v3: - Moved the remote host macaddress from struct flowside to > struct flow_common. I chose to call it 'omac' as suggested > by David, although in my understanding the correct name would be > 'emac'. (In general I find the address naming scheme confusing.) > - Adapted to new signature of function nl_mac_get(), now passing > it the index of the template interface. > v4: - Renamed flow_commeon->omac to flow_common->tap_omac to make is > role in the code clearer > v5: - Modified the criteria for ARP/NDP table lookup like in the > previous commits. > - Removed the PIF_TAP lookup case, as David suggested, and did > instead give the flow->tap_omac field a value marking it as > non-initialized. > - Calling the cache table instead of netlink for ARP/NDP lookup. > - Unconditionally using the potentially translated IP address > in the lookup, instead of only if NAT really was applied. > v6: - Using MAC_ZERO instead of own definitions > --- > flow.c | 2 ++ > flow.h | 2 ++ > 2 files changed, 4 insertions(+) >=20 > diff --git a/flow.c b/flow.c > index feefda3..510f3c5 100644 > --- a/flow.c > +++ b/flow.c > @@ -449,6 +449,7 @@ struct flowside *flow_target(const struct ctx *c, uni= on flow *flow, > =20 > =09switch (f->pif[INISIDE]) { > =09case PIF_TAP: > +=09=09memcpy(f->tap_omac, MAC_ZERO, ETH_ALEN); I see in the next patch that this is needed as an invalid value for f->tap_omac, but MAC_ZERO is actually a valid, usable MAC address. I guess we should use ff:ff:ff:ff:ff:ff, instead, as MAC_ONES, or MAC_UNSPEC. > =09=09tgtpif =3D fwd_nat_from_tap(c, proto, ini, tgt); > =09=09break; > =20 > @@ -458,6 +459,7 @@ struct flowside *flow_target(const struct ctx *c, uni= on flow *flow, > =20 > =09case PIF_HOST: > =09=09tgtpif =3D fwd_nat_from_host(c, proto, ini, tgt); > +=09=09fwd_neigh_mac_get(c, &ini->eaddr, f->tap_omac); > =09=09break; > =20 > =09default: > diff --git a/flow.h b/flow.h > index cac618a..f342895 100644 > --- a/flow.h > +++ b/flow.h > @@ -177,6 +177,7 @@ int flowside_connect(const struct ctx *c, int s, > * @type:=09Type of packet flow > * @pif[]:=09Interface for each side of the flow > * @side[]:=09Information for each side of the flow > + * @tap_omac: MAC address of remote endpoint as seen from the guest The descriptions of the other fields are aligned with tabs, this has a single space, so it's not aligned. > */ > struct flow_common { > #ifdef __GNUC__ > @@ -192,6 +193,7 @@ struct flow_common { > #endif > =09uint8_t=09=09pif[SIDES]; > =09struct flowside=09side[SIDES]; > +=09uint8_t=09=09tap_omac[6]; > }; > =20 > #define FLOW_INDEX_BITS=09=0917=09/* 128k - 1 */ --=20 Stefano