From 53dcac37f9ab4bd10190c9759cf5d49d0297299c Mon Sep 17 00:00:00 2001 From: Daniel Ding Date: Mon, 8 Jan 2024 17:35:36 +0800 Subject: [PATCH] fea: switch: support key options for gretap --- dist/rootfs/etc/openlan/switch/network/v1024.json.example | 2 +- pkg/switch/network.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dist/rootfs/etc/openlan/switch/network/v1024.json.example b/dist/rootfs/etc/openlan/switch/network/v1024.json.example index 8acf275..f2e4646 100755 --- a/dist/rootfs/etc/openlan/switch/network/v1024.json.example +++ b/dist/rootfs/etc/openlan/switch/network/v1024.json.example @@ -20,7 +20,7 @@ }, { "vlan": 0, - "interface": "gre:3.3.3.3" + "interface": "gre:3.3.3.3:55" } ] } diff --git a/pkg/switch/network.go b/pkg/switch/network.go index a1236d3..fe760c8 100755 --- a/pkg/switch/network.go +++ b/pkg/switch/network.go @@ -159,7 +159,10 @@ func (w *WorkerImpl) AddOutput(bridge string, port *LinuxPort) { if port.link == "" { port.link = co.GenName("gre") } + key, _ := strconv.Atoi(values[2]) link := &netlink.Gretap{ + IKey: uint32(key), + OKey: uint32(key), LinkAttrs: netlink.LinkAttrs{ Name: port.link, MTU: 1460,