Skip to content

Commit 4f629fe

Browse files
authored
Merge pull request #470 from loxilb-io/main
PR - Merge latest changes to OCI branch
2 parents 763cc30 + 15eed72 commit 4f629fe

File tree

13 files changed

+150
-4
lines changed

13 files changed

+150
-4
lines changed

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && echo $arch && i
4848
git clone --recurse-submodules https://github.com/loxilb-io/loxilb /root/loxilb-io/loxilb/ && \
4949
cd /root/loxilb-io/loxilb/ && go get . && make && \
5050
cp loxilb-ebpf/utils/mkllb_bpffs.sh /usr/local/sbin/mkllb_bpffs && \
51+
cp loxilb-ebpf/utils/loxilb_dp_tool /usr/local/sbin/loxilb_dp_tool && \
5152
cp api/certification/* /opt/loxilb/cert/ && cd - && \
5253
cp /root/loxilb-io/loxilb/loxilb-ebpf/kernel/loxilb_dp_debug /usr/local/sbin/loxilb_dp_debug && \
5354
cp /root/loxilb-io/loxilb/loxilb /usr/local/sbin/loxilb && \

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ docker-cp: build
3232
docker cp /opt/loxilb/llb_xdp_main.o $(loxilbid):/opt/loxilb/llb_xdp_main.o
3333
docker cp loxilb-ebpf/kernel/loxilb_dp_debug $(loxilbid):/usr/local/sbin/
3434
docker cp loxilb-ebpf/libbpf/src/libbpf.so.0.4.0 $(loxilbid):/usr/lib64/
35+
docker cp loxilb-ebpf/utils/loxilb_dp_tool $(loxilbid):/usr/local/sbin/
3536

3637
docker-cp-ebpf: build
3738
docker cp /opt/loxilb/llb_ebpf_main.o $(loxilbid):/opt/loxilb/llb_ebpf_main.o
@@ -46,6 +47,7 @@ docker-run:
4647
docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged -dt --entrypoint /bin/bash --name $(dock) ghcr.io/loxilb-io/loxilb:latest
4748

4849
docker-rp: docker-run docker-cp
50+
@docker exec -it $(dock) mkllb_bpffs 2>&1 >> /dev/null || true
4951
docker commit ${loxilbid} ghcr.io/loxilb-io/loxilb:latest
5052
@docker stop $(dock) 2>&1 >> /dev/null || true
5153
@docker rm $(dock) 2>&1 >> /dev/null || true

api/loxinlp/nlp.go

+13
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,19 @@ func ModLink(link nlp.Link, add bool) int {
825825
tunDst = iptun.Remote
826826
tunSrc = iptun.Local
827827
tk.LogIt(tk.LogInfo, "[NLP] IPTun %v (%s:%s), %s\n", name, tunSrc.String(), tunDst.String(), mod)
828+
} else if vtiTun, ok := link.(*nlp.Vti); ok {
829+
pType = cmn.PortVti
830+
if vtiTun.Remote == nil || vtiTun.Local == nil {
831+
return -1
832+
}
833+
834+
if vtiTun.Remote.IsUnspecified() || vtiTun.Local.IsUnspecified() {
835+
return -1
836+
}
837+
tunId = int(vtiTun.OKey)
838+
tunDst = vtiTun.Remote
839+
tunSrc = vtiTun.Local
840+
tk.LogIt(tk.LogInfo, "[NLP] VTITun %v (%s:%s), %s\n", name, tunSrc.String(), tunDst.String(), mod)
828841
} else if master != "" {
829842
pType = cmn.PortBondSif
830843
}

cicd/common.sh

+2
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ spawn_docker_host() {
135135
else
136136
docker run -u root --cap-add SYS_ADMIN -dit --name $dname eyes852/ubuntu-iperf-test:0.5
137137
fi
138+
elif [[ "$dtype" == "seahost" ]]; then
139+
docker run -u root --cap-add SYS_ADMIN -i -t --rm --detach --entrypoint /bin/bash --name $dname ghcr.io/loxilb-io/seagull:ubuntu1804
138140
fi
139141

140142
pid=""

cicd/ipsec2/validation.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ do
2424
then
2525
printf "Ping %-16s \t->\t %-16s \t\t: [OK]\n" lh$i ${servArr[j]} $size ;
2626
else
27-
printf "Ping %-16s \t->\t %-16s \t\t: [OK]\n" lh$i ${servArr[j]} $size ;
27+
printf "Ping %-16s \t->\t %-16s \t\t: [NOK]\n" lh$i ${servArr[j]} $size ;
2828
code=1
2929
fi
3030
j=$(( $j + 1 ))

cicd/sctplb-seagull/config.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
source ../common.sh
4+
5+
echo "#########################################"
6+
echo "Spawning all hosts"
7+
echo "#########################################"
8+
9+
spawn_docker_host --dock-type loxilb --dock-name llb1
10+
spawn_docker_host --dock-type seahost --dock-name l3h1
11+
spawn_docker_host --dock-type seahost --dock-name l3ep1
12+
spawn_docker_host --dock-type seahost --dock-name l3ep2
13+
spawn_docker_host --dock-type seahost --dock-name l3ep3
14+
15+
echo "#########################################"
16+
echo "Connecting and configuring hosts"
17+
echo "#########################################"
18+
19+
20+
connect_docker_hosts l3h1 llb1
21+
connect_docker_hosts l3ep1 llb1
22+
connect_docker_hosts l3ep2 llb1
23+
connect_docker_hosts l3ep3 llb1
24+
25+
26+
#L3 config
27+
config_docker_host --host1 l3h1 --host2 llb1 --ptype phy --addr 10.10.10.1/24 --gw 10.10.10.254
28+
config_docker_host --host1 l3ep1 --host2 llb1 --ptype phy --addr 31.31.31.1/24 --gw 31.31.31.254
29+
config_docker_host --host1 l3ep2 --host2 llb1 --ptype phy --addr 32.32.32.1/24 --gw 32.32.32.254
30+
config_docker_host --host1 l3ep3 --host2 llb1 --ptype phy --addr 33.33.33.1/24 --gw 33.33.33.254
31+
config_docker_host --host1 llb1 --host2 l3h1 --ptype phy --addr 10.10.10.254/24
32+
config_docker_host --host1 llb1 --host2 l3ep1 --ptype phy --addr 31.31.31.254/24
33+
config_docker_host --host1 llb1 --host2 l3ep2 --ptype phy --addr 32.32.32.254/24
34+
config_docker_host --host1 llb1 --host2 l3ep3 --ptype phy --addr 33.33.33.254/24
35+
sleep 5
36+
create_lb_rule llb1 20.20.20.1 --sctp=2020:8080 --endpoints=31.31.31.1:1
37+
create_lb_rule llb1 20.20.20.1 --tcp=2020:8080 --endpoints=31.31.31.1:1

cicd/sctplb-seagull/rmconfig.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
source ../common.sh
4+
5+
disconnect_docker_hosts l3h1 llb1
6+
disconnect_docker_hosts l3ep1 llb1
7+
disconnect_docker_hosts l3ep2 llb1
8+
disconnect_docker_hosts l3ep3 llb1
9+
10+
delete_docker_host llb1
11+
delete_docker_host l3h1
12+
delete_docker_host l3ep1
13+
delete_docker_host l3ep2
14+
delete_docker_host l3ep3
15+
16+
echo "#########################################"
17+
echo "Deleted testbed"
18+
echo "#########################################"

cicd/sctplb-seagull/validation.sh

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
source ../common.sh
3+
echo SCENARIO-sctplb
4+
5+
servArr=( "server1" "server2" "server3" )
6+
ep=( "31.31.31.1" "32.32.32.1" "33.33.33.1" )
7+
8+
$hexec l3ep1 ../common/sctp_server ${ep[0]} 8080 server1 >/dev/null 2>&1 &
9+
$hexec l3ep2 ../common/sctp_server ${ep[1]} 8080 server2 >/dev/null 2>&1 &
10+
$hexec l3ep3 ../common/sctp_server ${ep[2]} 8080 server3 >/dev/null 2>&1 &
11+
12+
sleep 5
13+
code=0
14+
j=0
15+
waitCount=0
16+
while [ $j -le 2 ]
17+
do
18+
res=$($hexec l3h1 timeout 10 ../common/sctp_client 10.10.10.1 0 ${ep[j]} 8080)
19+
#echo $res
20+
if [[ $res == "${servArr[j]}" ]]
21+
then
22+
echo "$res UP"
23+
j=$(( $j + 1 ))
24+
else
25+
echo "Waiting for ${servArr[j]}(${ep[j]})"
26+
waitCount=$(( $waitCount + 1 ))
27+
if [[ $waitCount == 10 ]];
28+
then
29+
echo "All Servers are not UP"
30+
echo SCENARIO-sctplb [FAILED]
31+
sudo pkill sctp_server >/dev/null 2>&1
32+
exit 1
33+
fi
34+
35+
fi
36+
sleep 1
37+
done
38+
39+
for i in {1..4}
40+
do
41+
for j in {0..2}
42+
do
43+
res=$($hexec l3h1 timeout 10 ../common/sctp_client 10.10.10.1 0 20.20.20.1 2020)
44+
echo -e $res
45+
if [[ $res != "${servArr[j]}" ]]
46+
then
47+
code=1
48+
fi
49+
sleep 1
50+
done
51+
done
52+
sudo pkill sctp_server >/dev/null 2>&1
53+
if [[ $code == 0 ]]
54+
then
55+
echo SCENARIO-sctplb [OK]
56+
else
57+
echo SCENARIO-sctplb [FAILED]
58+
fi
59+
exit $code
60+

loxinet/dpebpf_linux.go

+5
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,11 @@ func (e *DpEbpfH) DpPortPropMod(w *PortDpWorkQ) int {
475475
lRet := e.loadEbpfPgm(w.LoadEbpf)
476476
if lRet != 0 {
477477
tk.LogIt(tk.LogError, "ebpf load - %d error\n", w.PortNum)
478+
/* Shouldn't exit if the interface is not there, so return -1 and continue*/
479+
_, err := nlp.LinkByName(w.LoadEbpf)
480+
if err != nil {
481+
return -1
482+
}
478483
syscall.Exit(1)
479484
}
480485
}

loxinet/neighbor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func (n *NeighH) NeighRecursiveResolve(ne *Neigh) bool {
244244

245245
if ne.Resolved == true {
246246

247-
if port.IsL3TunPort() {
247+
if port.IsIPinIPTunPort() {
248248
err, pDstNet, tDat := n.Zone.Rt.Trie4.FindTrie(port.HInfo.TunDst.String())
249249
if err == 0 && pDstNet != nil {
250250
switch rtn := tDat.(type) {

loxinet/port.go

+8
Original file line numberDiff line numberDiff line change
@@ -1068,3 +1068,11 @@ func (p *Port) IsL3TunPort() bool {
10681068
}
10691069
return false
10701070
}
1071+
1072+
// IsIPinIPTunPort - check if the port is of IPinIPTun type
1073+
func (p *Port) IsIPinIPTunPort() bool {
1074+
if p.SInfo.PortType&(cmn.PortIPTun) != 0 {
1075+
return true
1076+
}
1077+
return false
1078+
}

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"time"
2626
)
2727

28-
var version string = "0.9.0"
28+
var version string = "0.9.1"
2929
var buildInfo string = ""
3030

3131
func main() {

0 commit comments

Comments
 (0)