Skip to content

Commit 481da0d

Browse files
pinoOgnivishvananda
authored andcommitted
Add support for ignore-df flag in gretap links
Signed-off-by: Giuseppe Ognibene <[email protected]>
1 parent 5f641a7 commit 481da0d

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

link.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,8 +1118,16 @@ type Gretap struct {
11181118
EncapFlags uint16
11191119
Link uint32
11201120
FlowBased bool
1121+
IgnoreDf GretapIgnoreDf
11211122
}
11221123

1124+
type GretapIgnoreDf uint8
1125+
1126+
const (
1127+
GRETAP_IGNORE_DF_FALSE = iota
1128+
GRETAP_IGNORE_DF_TRUE
1129+
)
1130+
11231131
func (gretap *Gretap) Attrs() *LinkAttrs {
11241132
return &gretap.LinkAttrs
11251133
}

link_linux.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3461,6 +3461,9 @@ func addGretapAttrs(gretap *Gretap, linkInfo *nl.RtAttr) {
34613461
data.AddRtAttr(nl.IFLA_GRE_ENCAP_FLAGS, nl.Uint16Attr(gretap.EncapFlags))
34623462
data.AddRtAttr(nl.IFLA_GRE_ENCAP_SPORT, htons(gretap.EncapSport))
34633463
data.AddRtAttr(nl.IFLA_GRE_ENCAP_DPORT, htons(gretap.EncapDport))
3464+
if gretap.IgnoreDf != GRETAP_IGNORE_DF_FALSE {
3465+
data.AddRtAttr(nl.IFLA_GRE_IGNORE_DF, nl.Uint8Attr(uint8(gretap.IgnoreDf)))
3466+
}
34643467
}
34653468

34663469
func parseGretapData(link Link, data []syscall.NetlinkRouteAttr) {

nl/link_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ const (
274274
IFLA_GRE_ENCAP_SPORT
275275
IFLA_GRE_ENCAP_DPORT
276276
IFLA_GRE_COLLECT_METADATA
277+
IFLA_GRE_IGNORE_DF
277278
IFLA_GRE_MAX = IFLA_GRE_COLLECT_METADATA
278279
)
279280

0 commit comments

Comments
 (0)