From f24382625b3d845c4e166f7cc04ca3d726c8a6b9 Mon Sep 17 00:00:00 2001 From: Tao Li Date: Thu, 27 May 2021 16:43:04 +0200 Subject: [PATCH] add proto field to Iptun --- link.go | 1 + link_linux.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/link.go b/link.go index 82d0360..33c8723 100644 --- a/link.go +++ b/link.go @@ -1038,6 +1038,7 @@ type Iptun struct { EncapType uint16 EncapFlags uint16 FlowBased bool + Proto uint8 } func (iptun *Iptun) Attrs() *LinkAttrs { diff --git a/link_linux.go b/link_linux.go index aa998e3..ffad73d 100644 --- a/link_linux.go +++ b/link_linux.go @@ -2874,6 +2874,7 @@ func addIptunAttrs(iptun *Iptun, linkInfo *nl.RtAttr) { data.AddRtAttr(nl.IFLA_IPTUN_ENCAP_FLAGS, nl.Uint16Attr(iptun.EncapFlags)) data.AddRtAttr(nl.IFLA_IPTUN_ENCAP_SPORT, htons(iptun.EncapSport)) data.AddRtAttr(nl.IFLA_IPTUN_ENCAP_DPORT, htons(iptun.EncapDport)) + data.AddRtAttr(nl.IFLA_IPTUN_PROTO, nl.Uint8Attr(iptun.Proto)) } func parseIptunData(link Link, data []syscall.NetlinkRouteAttr) { @@ -2904,6 +2905,8 @@ func parseIptunData(link Link, data []syscall.NetlinkRouteAttr) { iptun.EncapFlags = native.Uint16(datum.Value[0:2]) case nl.IFLA_IPTUN_COLLECT_METADATA: iptun.FlowBased = true + case nl.IFLA_IPTUN_PROTO: + iptun.Proto = datum.Value[0] } } }