[PATCH] hsr: prp: honor master promisc mode for local delivery with macvlan

Aravind Krishna posted 1 patch 2 days, 18 hours ago
net/hsr/hsr_forward.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
[PATCH] hsr: prp: honor master promisc mode for local delivery with macvlan
Posted by Aravind Krishna 2 days, 18 hours ago
When running MACVLAN over PRP, packets can be expected to be delivered
to the local stack when the PRP/HSR master is in promiscuous mode.

Update local destination handling in check_local_dest() so that if the
master device exists and has IFF_PROMISC set, the packet is marked
PACKET_HOST and treated as local destination.

This enables expected receive behavior for MACVLAN over PRP setups.

Signed-off-by: Aravind-kris <aravindkrishhna@gmail.com>
---
 net/hsr/hsr_forward.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c
index 0774981a65c1..38ed6b09fc4a 100644
--- a/net/hsr/hsr_forward.c
+++ b/net/hsr/hsr_forward.c
@@ -589,6 +589,8 @@ static void hsr_forward_do(struct hsr_frame_info *frame)
 static void check_local_dest(struct hsr_priv *hsr, struct sk_buff *skb,
 			     struct hsr_frame_info *frame)
 {
+	struct hsr_port *master;
+
 	if (hsr_addr_is_self(hsr, eth_hdr(skb)->h_dest)) {
 		frame->is_local_exclusive = true;
 		skb->pkt_type = PACKET_HOST;
@@ -600,8 +602,24 @@ static void check_local_dest(struct hsr_priv *hsr, struct sk_buff *skb,
 	    skb->pkt_type == PACKET_MULTICAST ||
 	    skb->pkt_type == PACKET_BROADCAST) {
 		frame->is_local_dest = true;
-	} else {
-		frame->is_local_dest = false;
+	}
+	else
+	{
+		master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
+
+		if (!master || !master->dev)
+		{
+        		frame->is_local_dest = false;
+		}
+		else if (master->dev->flags & IFF_PROMISC)
+		{
+        		skb->pkt_type = PACKET_HOST;
+        		frame->is_local_dest = true;
+		}
+		else
+		{
+			frame->is_local_dest = false;
+		}
 	}
 }
 
-- 
2.34.1
Re: [PATCH] hsr: prp: honor master promisc mode for local delivery with macvlan
Posted by Felix Maurer 13 hours ago
Hi Aravind,

On Wed, Jul 22, 2026 at 09:46:29AM +0530, Aravind Krishna wrote:
> When running MACVLAN over PRP, packets can be expected to be delivered
> to the local stack when the PRP/HSR master is in promiscuous mode.
>
> Update local destination handling in check_local_dest() so that if the
> master device exists and has IFF_PROMISC set, the packet is marked
> PACKET_HOST and treated as local destination.
>
> This enables expected receive behavior for MACVLAN over PRP setups.
>
> Signed-off-by: Aravind-kris <aravindkrishhna@gmail.com>

Thank you for your patch! For future submissions, please follow the
netdev guidelines [1], in particular please:
- add the target tree to the subject,
- run scripts/checkpatch.pl on your patches before submission,
- follow the kernel / netdev code style (checkpatch will catch a lot of
  that but not necessarily everything).

Now, for your patch contents: IIUC, you want to create a macvlan
interface on top of an hsr interface in PRP mode. I am not sure if this
is something we should support at all. At least, it is not as simple as
forwarding all traffic to the stack. HSR and PRP both require pretty
special handling of MAC addresses. The whole hsr code relies on knowing
the MAC address of the local interface (and that is a single address at
the moment). Also, an HSR/PRP node is expected to send supervision
frames containing its address. These wouldn't be sent for the macvlan
addresses at all at the moment.

Can you go a bit into detail on what is your use case? Maybe we can make
that possible in another way. For example, the usual way to add more
"devices" (physical or virtual) behind a HSR/PRP node would be a RedBox.
We already support that for HSR and there is somebody working on support
for PRP.

Thanks,
   Felix


[1]: https://docs.kernel.org/process/maintainer-netdev.html

> ---
>  net/hsr/hsr_forward.c | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c
> index 0774981a65c1..38ed6b09fc4a 100644
> --- a/net/hsr/hsr_forward.c
> +++ b/net/hsr/hsr_forward.c
> @@ -589,6 +589,8 @@ static void hsr_forward_do(struct hsr_frame_info *frame)
>  static void check_local_dest(struct hsr_priv *hsr, struct sk_buff *skb,
>  			     struct hsr_frame_info *frame)
>  {
> +	struct hsr_port *master;
> +
>  	if (hsr_addr_is_self(hsr, eth_hdr(skb)->h_dest)) {
>  		frame->is_local_exclusive = true;
>  		skb->pkt_type = PACKET_HOST;
> @@ -600,8 +602,24 @@ static void check_local_dest(struct hsr_priv *hsr, struct sk_buff *skb,
>  	    skb->pkt_type == PACKET_MULTICAST ||
>  	    skb->pkt_type == PACKET_BROADCAST) {
>  		frame->is_local_dest = true;
> -	} else {
> -		frame->is_local_dest = false;
> +	}
> +	else
> +	{
> +		master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
> +
> +		if (!master || !master->dev)
> +		{
> +        		frame->is_local_dest = false;
> +		}
> +		else if (master->dev->flags & IFF_PROMISC)
> +		{
> +        		skb->pkt_type = PACKET_HOST;
> +        		frame->is_local_dest = true;
> +		}
> +		else
> +		{
> +			frame->is_local_dest = false;
> +		}
>  	}
>  }
>
> --
> 2.34.1
>