Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR - Merge latest changes to OCI branch #470

Merged
merged 12 commits into from
Dec 26, 2023
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 13 additions & 0 deletions api/loxinlp/nlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions cicd/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down
2 changes: 1 addition & 1 deletion cicd/ipsec2/validation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ))
Expand Down
37 changes: 37 additions & 0 deletions cicd/sctplb-seagull/config.sh
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions cicd/sctplb-seagull/rmconfig.sh
Original file line number Diff line number Diff line change
@@ -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 "#########################################"
60 changes: 60 additions & 0 deletions cicd/sctplb-seagull/validation.sh
Original file line number Diff line number Diff line change
@@ -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

5 changes: 5 additions & 0 deletions loxinet/dpebpf_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion loxinet/neighbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions loxinet/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"time"
)

var version string = "0.9.0"
var version string = "0.9.1"
var buildInfo string = ""

func main() {
Expand Down
Loading