Bmv2 multicast modify port during egress

Hello, I try to find a way to generate new packets using multicast. My simple idea is to change metadata egress_port during egress processing. However, when I run this code, the replicated packets content is modified as I want, but the egress port does not change. Does multicast can only be forwarded to the defined port?


Any advice would be very helpful,thanks! :grin:

Many switch architectures forbid you to change the output port of a packet during egress processing, including v1model, PSA, and TNA P4 architectures. This is true for all packets during egress processing, whether they are unicast, multicast, mirrored/cloned, or any other reason they are performing egress processing. There are good reasons for this restriction: P4~16~ Portable Switch Architecture (PSA)

The previous section on why egress processing exists at all may also be interesting.

There are several ways that might achieve your goal, depending upon exactly what you are trying to do, but in general you must select a packet’s output port during ingress processing.