From 8a630d16a3b7e75b09b80e49b9e17ea415071cae Mon Sep 17 00:00:00 2001 From: Nikhil Malik Date: Wed, 20 Dec 2023 18:05:08 +0900 Subject: [PATCH 1/6] Don't exit if interface is not found --- loxinet/dpebpf_linux.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/loxinet/dpebpf_linux.go b/loxinet/dpebpf_linux.go index bc84e81ad..f6e4c2abb 100644 --- a/loxinet/dpebpf_linux.go +++ b/loxinet/dpebpf_linux.go @@ -475,6 +475,11 @@ func (e *DpEbpfH) DpPortPropMod(w *PortDpWorkQ) int { lRet := e.loadEbpfPgm(w.LoadEbpf) if lRet != 0 { tk.LogIt(tk.LogError, "ebpf load - %d error\n", w.PortNum) + /* Shouldn't exit if the interface is not there, so return -1 and continue*/ + _, err := nlp.LinkByName(w.LoadEbpf) + if err != nil { + return -1 + } syscall.Exit(1) } } From 396c2b29bad82072f792966682ef7587b4d14b3a Mon Sep 17 00:00:00 2001 From: Nikhil Malik Date: Thu, 21 Dec 2023 14:47:36 +0900 Subject: [PATCH 2/6] IPsec2 validation script updated --- cicd/ipsec2/validation.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cicd/ipsec2/validation.sh b/cicd/ipsec2/validation.sh index 29fe8e2a9..73f71a7f2 100755 --- a/cicd/ipsec2/validation.sh +++ b/cicd/ipsec2/validation.sh @@ -24,7 +24,7 @@ do then printf "Ping %-16s \t->\t %-16s \t\t: [OK]\n" lh$i ${servArr[j]} $size ; else - printf "Ping %-16s \t->\t %-16s \t\t: [OK]\n" lh$i ${servArr[j]} $size ; + printf "Ping %-16s \t->\t %-16s \t\t: [NOK]\n" lh$i ${servArr[j]} $size ; code=1 fi j=$(( $j + 1 )) From 0642ad4a3fee39182b0e91b838e0be75e834aeb8 Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Fri, 22 Dec 2023 20:19:18 +0900 Subject: [PATCH 3/6] Fix for ipsec vti cicd not working --- api/loxinlp/nlp.go | 13 +++++++++++++ loxinet/neighbor.go | 2 +- loxinet/port.go | 8 ++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/api/loxinlp/nlp.go b/api/loxinlp/nlp.go index 9aeb64386..59880d2e4 100644 --- a/api/loxinlp/nlp.go +++ b/api/loxinlp/nlp.go @@ -825,6 +825,19 @@ func ModLink(link nlp.Link, add bool) int { tunDst = iptun.Remote tunSrc = iptun.Local tk.LogIt(tk.LogInfo, "[NLP] IPTun %v (%s:%s), %s\n", name, tunSrc.String(), tunDst.String(), mod) + } else if vtiTun, ok := link.(*nlp.Vti); ok { + pType = cmn.PortVti + if vtiTun.Remote == nil || vtiTun.Local == nil { + return -1 + } + + if vtiTun.Remote.IsUnspecified() || vtiTun.Local.IsUnspecified() { + return -1 + } + tunId = int(vtiTun.OKey) + tunDst = vtiTun.Remote + tunSrc = vtiTun.Local + tk.LogIt(tk.LogInfo, "[NLP] VTITun %v (%s:%s), %s\n", name, tunSrc.String(), tunDst.String(), mod) } else if master != "" { pType = cmn.PortBondSif } diff --git a/loxinet/neighbor.go b/loxinet/neighbor.go index e1e919d8b..042bee351 100644 --- a/loxinet/neighbor.go +++ b/loxinet/neighbor.go @@ -244,7 +244,7 @@ func (n *NeighH) NeighRecursiveResolve(ne *Neigh) bool { if ne.Resolved == true { - if port.IsL3TunPort() { + if port.IsIPinIPTunPort() { err, pDstNet, tDat := n.Zone.Rt.Trie4.FindTrie(port.HInfo.TunDst.String()) if err == 0 && pDstNet != nil { switch rtn := tDat.(type) { diff --git a/loxinet/port.go b/loxinet/port.go index cbb41e3fb..c8683fafb 100644 --- a/loxinet/port.go +++ b/loxinet/port.go @@ -1068,3 +1068,11 @@ func (p *Port) IsL3TunPort() bool { } return false } + +// IsIPinIPTunPort - check if the port is of IPinIPTun type +func (p *Port) IsIPinIPTunPort() bool { + if p.SInfo.PortType&(cmn.PortIPTun) != 0 { + return true + } + return false +} From 04b29356c03dd7c6610925f74122eb5c5914e271 Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Fri, 22 Dec 2023 22:16:03 +0900 Subject: [PATCH 4/6] support for sctplb cicd with seagull --- cicd/common.sh | 2 ++ cicd/sctplb-seagull/config.sh | 37 +++++++++++++++++++ cicd/sctplb-seagull/rmconfig.sh | 18 ++++++++++ cicd/sctplb-seagull/validation.sh | 60 +++++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100755 cicd/sctplb-seagull/config.sh create mode 100755 cicd/sctplb-seagull/rmconfig.sh create mode 100755 cicd/sctplb-seagull/validation.sh diff --git a/cicd/common.sh b/cicd/common.sh index 79fd9285b..97868c3dc 100644 --- a/cicd/common.sh +++ b/cicd/common.sh @@ -135,6 +135,8 @@ spawn_docker_host() { else docker run -u root --cap-add SYS_ADMIN -dit --name $dname eyes852/ubuntu-iperf-test:0.5 fi + elif [[ "$dtype" == "seahost" ]]; then + docker run -u root --cap-add SYS_ADMIN -i -t --rm --detach --entrypoint /bin/bash --name $dname ghcr.io/loxilb-io/seagull:ubuntu1804 fi pid="" diff --git a/cicd/sctplb-seagull/config.sh b/cicd/sctplb-seagull/config.sh new file mode 100755 index 000000000..5e67cb794 --- /dev/null +++ b/cicd/sctplb-seagull/config.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +source ../common.sh + +echo "#########################################" +echo "Spawning all hosts" +echo "#########################################" + +spawn_docker_host --dock-type loxilb --dock-name llb1 +spawn_docker_host --dock-type seahost --dock-name l3h1 +spawn_docker_host --dock-type seahost --dock-name l3ep1 +spawn_docker_host --dock-type seahost --dock-name l3ep2 +spawn_docker_host --dock-type seahost --dock-name l3ep3 + +echo "#########################################" +echo "Connecting and configuring hosts" +echo "#########################################" + + +connect_docker_hosts l3h1 llb1 +connect_docker_hosts l3ep1 llb1 +connect_docker_hosts l3ep2 llb1 +connect_docker_hosts l3ep3 llb1 + + +#L3 config +config_docker_host --host1 l3h1 --host2 llb1 --ptype phy --addr 10.10.10.1/24 --gw 10.10.10.254 +config_docker_host --host1 l3ep1 --host2 llb1 --ptype phy --addr 31.31.31.1/24 --gw 31.31.31.254 +config_docker_host --host1 l3ep2 --host2 llb1 --ptype phy --addr 32.32.32.1/24 --gw 32.32.32.254 +config_docker_host --host1 l3ep3 --host2 llb1 --ptype phy --addr 33.33.33.1/24 --gw 33.33.33.254 +config_docker_host --host1 llb1 --host2 l3h1 --ptype phy --addr 10.10.10.254/24 +config_docker_host --host1 llb1 --host2 l3ep1 --ptype phy --addr 31.31.31.254/24 +config_docker_host --host1 llb1 --host2 l3ep2 --ptype phy --addr 32.32.32.254/24 +config_docker_host --host1 llb1 --host2 l3ep3 --ptype phy --addr 33.33.33.254/24 +sleep 5 +create_lb_rule llb1 20.20.20.1 --sctp=2020:8080 --endpoints=31.31.31.1:1 +create_lb_rule llb1 20.20.20.1 --tcp=2020:8080 --endpoints=31.31.31.1:1 diff --git a/cicd/sctplb-seagull/rmconfig.sh b/cicd/sctplb-seagull/rmconfig.sh new file mode 100755 index 000000000..9ea80577f --- /dev/null +++ b/cicd/sctplb-seagull/rmconfig.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +source ../common.sh + +disconnect_docker_hosts l3h1 llb1 +disconnect_docker_hosts l3ep1 llb1 +disconnect_docker_hosts l3ep2 llb1 +disconnect_docker_hosts l3ep3 llb1 + +delete_docker_host llb1 +delete_docker_host l3h1 +delete_docker_host l3ep1 +delete_docker_host l3ep2 +delete_docker_host l3ep3 + +echo "#########################################" +echo "Deleted testbed" +echo "#########################################" diff --git a/cicd/sctplb-seagull/validation.sh b/cicd/sctplb-seagull/validation.sh new file mode 100755 index 000000000..2d36c99d5 --- /dev/null +++ b/cicd/sctplb-seagull/validation.sh @@ -0,0 +1,60 @@ +#!/bin/bash +source ../common.sh +echo SCENARIO-sctplb + +servArr=( "server1" "server2" "server3" ) +ep=( "31.31.31.1" "32.32.32.1" "33.33.33.1" ) + +$hexec l3ep1 ../common/sctp_server ${ep[0]} 8080 server1 >/dev/null 2>&1 & +$hexec l3ep2 ../common/sctp_server ${ep[1]} 8080 server2 >/dev/null 2>&1 & +$hexec l3ep3 ../common/sctp_server ${ep[2]} 8080 server3 >/dev/null 2>&1 & + +sleep 5 +code=0 +j=0 +waitCount=0 +while [ $j -le 2 ] +do + res=$($hexec l3h1 timeout 10 ../common/sctp_client 10.10.10.1 0 ${ep[j]} 8080) + #echo $res + if [[ $res == "${servArr[j]}" ]] + then + echo "$res UP" + j=$(( $j + 1 )) + else + echo "Waiting for ${servArr[j]}(${ep[j]})" + waitCount=$(( $waitCount + 1 )) + if [[ $waitCount == 10 ]]; + then + echo "All Servers are not UP" + echo SCENARIO-sctplb [FAILED] + sudo pkill sctp_server >/dev/null 2>&1 + exit 1 + fi + + fi + sleep 1 +done + +for i in {1..4} +do +for j in {0..2} +do + res=$($hexec l3h1 timeout 10 ../common/sctp_client 10.10.10.1 0 20.20.20.1 2020) + echo -e $res + if [[ $res != "${servArr[j]}" ]] + then + code=1 + fi + sleep 1 +done +done +sudo pkill sctp_server >/dev/null 2>&1 +if [[ $code == 0 ]] +then + echo SCENARIO-sctplb [OK] +else + echo SCENARIO-sctplb [FAILED] +fi +exit $code + From 142d9653c3ae18882eca9e5766eebfb4a7f8fc20 Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Tue, 26 Dec 2023 22:26:36 +0900 Subject: [PATCH 5/6] Workaround for virtio buffer issue with sctp --- Dockerfile | 1 + Makefile | 2 ++ loxilb-ebpf | 2 +- main.go | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9414416b6..754ca0d2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,6 +48,7 @@ RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && echo $arch && i git clone --recurse-submodules https://github.com/loxilb-io/loxilb /root/loxilb-io/loxilb/ && \ cd /root/loxilb-io/loxilb/ && go get . && make && \ cp loxilb-ebpf/utils/mkllb_bpffs.sh /usr/local/sbin/mkllb_bpffs && \ + cp loxilb-ebpf/utils/loxilb_dp_tool /usr/local/sbin/loxilb_dp_tool && \ cp api/certification/* /opt/loxilb/cert/ && cd - && \ cp /root/loxilb-io/loxilb/loxilb-ebpf/kernel/loxilb_dp_debug /usr/local/sbin/loxilb_dp_debug && \ cp /root/loxilb-io/loxilb/loxilb /usr/local/sbin/loxilb && \ diff --git a/Makefile b/Makefile index 51bee0b4c..bf070e80c 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,7 @@ docker-cp: build docker cp /opt/loxilb/llb_xdp_main.o $(loxilbid):/opt/loxilb/llb_xdp_main.o docker cp loxilb-ebpf/kernel/loxilb_dp_debug $(loxilbid):/usr/local/sbin/ docker cp loxilb-ebpf/libbpf/src/libbpf.so.0.4.0 $(loxilbid):/usr/lib64/ + docker cp loxilb-ebpf/utils/loxilb_dp_tool $(loxilbid):/usr/local/sbin/ docker-cp-ebpf: build docker cp /opt/loxilb/llb_ebpf_main.o $(loxilbid):/opt/loxilb/llb_ebpf_main.o @@ -46,6 +47,7 @@ docker-run: docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged -dt --entrypoint /bin/bash --name $(dock) ghcr.io/loxilb-io/loxilb:latest docker-rp: docker-run docker-cp + @docker exec -it $(dock) mkllb_bpffs 2>&1 >> /dev/null || true docker commit ${loxilbid} ghcr.io/loxilb-io/loxilb:latest @docker stop $(dock) 2>&1 >> /dev/null || true @docker rm $(dock) 2>&1 >> /dev/null || true diff --git a/loxilb-ebpf b/loxilb-ebpf index 9137e240d..a06beb2a6 160000 --- a/loxilb-ebpf +++ b/loxilb-ebpf @@ -1 +1 @@ -Subproject commit 9137e240dccf00ee41c7c8ab3b20b479e1989735 +Subproject commit a06beb2a6aa48a8f1a957abbebee2fd9ca25d158 diff --git a/main.go b/main.go index dc116c708..d7e98c850 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ import ( "time" ) -var version string = "0.9.0" +var version string = "0.9.1" var buildInfo string = "" func main() { From 95144a4df979699c3a818f08364dccd89e31fc5e Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Tue, 26 Dec 2023 22:38:04 +0900 Subject: [PATCH 6/6] Workaround for virtio buffer issue with sctp --- loxilb-ebpf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loxilb-ebpf b/loxilb-ebpf index a06beb2a6..083b53b51 160000 --- a/loxilb-ebpf +++ b/loxilb-ebpf @@ -1 +1 @@ -Subproject commit a06beb2a6aa48a8f1a957abbebee2fd9ca25d158 +Subproject commit 083b53b51a53a0dd0436a28ba720372dc4e40e29