From d22c22643f9ab426c6cd81c15a105214feda32ec Mon Sep 17 00:00:00 2001 From: Teja Tamboli Date: Mon, 2 Mar 2026 19:36:22 +0000 Subject: [PATCH] Added VLAN field support while creating acl entry --- dataplane/saiserver/acl.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dataplane/saiserver/acl.go b/dataplane/saiserver/acl.go index 0b592cee..2cdaee55 100644 --- a/dataplane/saiserver/acl.go +++ b/dataplane/saiserver/acl.go @@ -245,6 +245,13 @@ func (a *acl) createAclEntryFields(req *saipb.CreateAclEntryRequest, id uint64, Masks: []byte{mask}, }) } + if req.GetFieldOuterVlanId() != nil { + aReq.EntryDesc.GetFlow().Fields = append(aReq.EntryDesc.GetFlow().Fields, &fwdpb.PacketFieldMaskedBytes{ + FieldId: &fwdpb.PacketFieldId{Field: &fwdpb.PacketField{FieldNum: fwdpb.PacketFieldNum_PACKET_FIELD_NUM_VLAN_TAG}}, + Bytes: binary.BigEndian.AppendUint16(nil, uint16(req.GetFieldOuterVlanId().GetDataUint())), + Masks: binary.BigEndian.AppendUint16(nil, uint16(req.GetFieldOuterVlanId().GetMaskUint())), + }) + } ipv6Field := false ipv6Addr := make([]byte, 16) ipv6Mask := make([]byte, 16) @@ -466,6 +473,11 @@ func (a *acl) CreateAclEntry(ctx context.Context, req *saipb.CreateAclEntryReque fwdconfig.Action(fwdconfig.LookupAction(policerTabler)).Build(), ) } + if req.ActionSetOuterVlanId != nil { + aReq.Actions = append(aReq.Actions, + fwdconfig.Action(fwdconfig.UpdateAction(fwdpb.UpdateType_UPDATE_TYPE_SET, fwdpb.PacketFieldNum_PACKET_FIELD_NUM_VLAN_TAG). + WithValue(binary.BigEndian.AppendUint16(nil, uint16(req.GetActionSetOuterVlanId().GetUint())))).Build()) + } cpuPortReq := &saipb.GetSwitchAttributeRequest{Oid: switchID, AttrType: []saipb.SwitchAttr{saipb.SwitchAttr_SWITCH_ATTR_CPU_PORT}} resp := &saipb.GetSwitchAttributeResponse{}