@@ -270,6 +270,7 @@ type SEG6LocalEncap struct {
270270 Action int
271271 Segments []net.IP // from SRH in seg6_local_lwt
272272 Table int // table id for End.T and End.DT6
273+ VrfTable int // vrftable id for END.DT4 and END.DT6
273274 InAddr net.IP
274275 In6Addr net.IP
275276 Iif int
@@ -305,6 +306,9 @@ func (e *SEG6LocalEncap) Decode(buf []byte) error {
305306 case nl .SEG6_LOCAL_TABLE :
306307 e .Table = int (native .Uint32 (attr .Value [0 :4 ]))
307308 e .Flags [nl .SEG6_LOCAL_TABLE ] = true
309+ case nl .SEG6_LOCAL_VRFTABLE :
310+ e .VrfTable = int (native .Uint32 (attr .Value [0 :4 ]))
311+ e .Flags [nl .SEG6_LOCAL_VRFTABLE ] = true
308312 case nl .SEG6_LOCAL_NH4 :
309313 e .InAddr = net .IP (attr .Value [0 :4 ])
310314 e .Flags [nl .SEG6_LOCAL_NH4 ] = true
@@ -361,6 +365,15 @@ func (e *SEG6LocalEncap) Encode() ([]byte, error) {
361365 native .PutUint32 (attr [4 :], uint32 (e .Table ))
362366 res = append (res , attr ... )
363367 }
368+
369+ if e .Flags [nl .SEG6_LOCAL_VRFTABLE ] {
370+ attr := make ([]byte , 8 )
371+ native .PutUint16 (attr , 8 )
372+ native .PutUint16 (attr [2 :], nl .SEG6_LOCAL_VRFTABLE )
373+ native .PutUint32 (attr [4 :], uint32 (e .VrfTable ))
374+ res = append (res , attr ... )
375+ }
376+
364377 if e .Flags [nl .SEG6_LOCAL_NH4 ] {
365378 attr := make ([]byte , 4 )
366379 native .PutUint16 (attr , 8 )
@@ -413,6 +426,11 @@ func (e *SEG6LocalEncap) String() string {
413426 if e .Flags [nl .SEG6_LOCAL_TABLE ] {
414427 strs = append (strs , fmt .Sprintf ("table %d" , e .Table ))
415428 }
429+
430+ if e .Flags [nl .SEG6_LOCAL_VRFTABLE ] {
431+ strs = append (strs , fmt .Sprintf ("vrftable %d" , e .VrfTable ))
432+ }
433+
416434 if e .Flags [nl .SEG6_LOCAL_NH4 ] {
417435 strs = append (strs , fmt .Sprintf ("nh4 %s" , e .InAddr ))
418436 }
@@ -477,7 +495,7 @@ func (e *SEG6LocalEncap) Equal(x Encap) bool {
477495 if ! e .InAddr .Equal (o .InAddr ) || ! e .In6Addr .Equal (o .In6Addr ) {
478496 return false
479497 }
480- if e .Action != o .Action || e .Table != o .Table || e .Iif != o .Iif || e .Oif != o .Oif || e .bpf != o .bpf {
498+ if e .Action != o .Action || e .Table != o .Table || e .Iif != o .Iif || e .Oif != o .Oif || e .bpf != o .bpf || e . VrfTable != o . VrfTable {
481499 return false
482500 }
483501 return true
0 commit comments