diff --git a/link.go b/link.go index 887c87d..4f4d34d 100644 --- a/link.go +++ b/link.go @@ -1022,16 +1022,17 @@ func (v *VrfSlave) SlaveType() string { // https://github.com/torvalds/linux/blob/47ec5303d73ea344e84f46660fff693c57641386/drivers/net/geneve.c#L1209-L1223 type Geneve struct { LinkAttrs - ID uint32 // vni - Remote net.IP - Ttl uint8 - Tos uint8 - Dport uint16 - UdpCsum uint8 - UdpZeroCsum6Tx uint8 - UdpZeroCsum6Rx uint8 - Link uint32 - FlowBased bool + ID uint32 // vni + Remote net.IP + Ttl uint8 + Tos uint8 + Dport uint16 + UdpCsum uint8 + UdpZeroCsum6Tx uint8 + UdpZeroCsum6Rx uint8 + Link uint32 + FlowBased bool + InnerProtoInherit bool } func (geneve *Geneve) Attrs() *LinkAttrs { diff --git a/link_linux.go b/link_linux.go index 9490561..66a540e 100644 --- a/link_linux.go +++ b/link_linux.go @@ -2997,6 +2997,10 @@ func linkFlags(rawFlags uint32) net.Flags { func addGeneveAttrs(geneve *Geneve, linkInfo *nl.RtAttr) { data := linkInfo.AddRtAttr(nl.IFLA_INFO_DATA, nil) + if geneve.InnerProtoInherit { + data.AddRtAttr(nl.IFLA_GENEVE_INNER_PROTO_INHERIT, []byte{}) + } + if geneve.FlowBased { geneve.ID = 0 data.AddRtAttr(nl.IFLA_GENEVE_COLLECT_METADATA, []byte{}) @@ -3043,6 +3047,8 @@ func parseGeneveData(link Link, data []syscall.NetlinkRouteAttr) { geneve.Tos = uint8(datum.Value[0]) case nl.IFLA_GENEVE_COLLECT_METADATA: geneve.FlowBased = true + case nl.IFLA_GENEVE_INNER_PROTO_INHERIT: + geneve.InnerProtoInherit = true } } } diff --git a/link_test.go b/link_test.go index 1508d24..aa9ed64 100644 --- a/link_test.go +++ b/link_test.go @@ -389,6 +389,10 @@ func compareGeneve(t *testing.T, expected, actual *Geneve) { t.Fatal("Geneve.FlowBased doesn't match") } + if actual.InnerProtoInherit != expected.InnerProtoInherit { + t.Fatal("Geneve.InnerProtoInherit doesn't match") + } + // TODO: we should implement the rest of the geneve methods } diff --git a/nl/link_linux.go b/nl/link_linux.go index 6cb118f..9492c5c 100644 --- a/nl/link_linux.go +++ b/nl/link_linux.go @@ -227,7 +227,10 @@ const ( IFLA_GENEVE_UDP_ZERO_CSUM6_TX IFLA_GENEVE_UDP_ZERO_CSUM6_RX IFLA_GENEVE_LABEL - IFLA_GENEVE_MAX = IFLA_GENEVE_LABEL + IFLA_GENEVE_TTL_INHERIT + IFLA_GENEVE_DF + IFLA_GENEVE_INNER_PROTO_INHERIT + IFLA_GENEVE_MAX = IFLA_GENEVE_INNER_PROTO_INHERIT ) const (