mirror of https://github.com/vishvananda/netlink
link: add INNER_PROTO_INHERIT support for Geneve
This commit is contained in:
parent
70def89fcb
commit
9453b0562a
21
link.go
21
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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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 (
|
||||
|
|
Loading…
Reference in New Issue