Simple testing

This commit is contained in:
Daniel Adolfsson 2019-12-16 21:27:58 +01:00
parent 9c97925b43
commit 749ac25d4d
3 changed files with 93 additions and 2 deletions

11
ndppd.test.conf Normal file
View File

@ -0,0 +1,11 @@
proxy ndppd.rt0 {
rule dead:1::1 {
iface ndppd.rt1
}
}
proxy ndppd.rt1 {
rule dead::1 {
iface ndppd.rt0
}
}

View File

@ -69,7 +69,7 @@ enum {
NDL_ALPHA = 256, // [a-zA-Z]
NDL_ALNUM, // [a-zA-Z0-9]
NDL_DIGIT, // [0-9]
NDL_EALNM, // [a-zA-Z0-9_-]
NDL_EALNM, // [a-zA-Z0-9_.-]
NDL_SPACE, // [\s]
NDL_SNONL, // [^\S\n]
NDL_XNONL, // [^\n]
@ -147,7 +147,7 @@ static char ndL_accept_one(ndL_state_t *state, int cl)
break;
case NDL_EALNM:
result = isalnum(ch) || ch == '_' || ch == '-';
result = isalnum(ch) || ch == '.' || ch == '_' || ch == '-';
break;
case NDL_SPACE:

80
test.sh Normal file
View File

@ -0,0 +1,80 @@
#!/bin/bash
case "$1" in
"cleanup")
ip netns del ndppd.0
ip netns del ndppd.rt
ip netns del ndppd.1
ip link del ndppd.br0
ip link del ndppd.br1
exit 0
;;
"setup")
ip netns add ndppd.0
ip netns add ndppd.rt
ip netns add ndppd.1
ip link add ndppd.0 type veth peer name ndppd.0b
ip link add ndppd.rt0 type veth peer name ndppd.rt0b
ip link add ndppd.rt1 type veth peer name ndppd.rt1b
ip link add ndppd.1 type veth peer name ndppd.1b
ip link set ndppd.0 netns ndppd.0
ip link set ndppd.rt0 netns ndppd.rt
ip link set ndppd.rt1 netns ndppd.rt
ip link set ndppd.1 netns ndppd.1
ip link add name ndppd.br0 type bridge
ip link add name ndppd.br1 type bridge
ip link set ndppd.0b master ndppd.br0
ip link set ndppd.rt0b master ndppd.br0
ip link set ndppd.rt1b master ndppd.br1
ip link set ndppd.1b master ndppd.br1
#ip link set ndppd.ext.b type bridge_slave mcast_flood off
#ip link set ndppd.rtext.b type bridge_slave mcast_flood off
#ip link set ndppd.rtint.b type bridge_slave mcast_flood off
#ip link set ndppd.int.b type bridge_slave mcast_flood off
ip link set ndppd.0b up
ip link set ndppd.rt0b up
ip link set ndppd.rt1b up
ip link set ndppd.1b up
ip link set ndppd.br0 up
ip link set ndppd.br1 up
ip netns exec ndppd.0 ip link set ndppd.0 up
ip netns exec ndppd.rt ip link set ndppd.rt0 up
ip netns exec ndppd.rt ip link set ndppd.rt1 up
ip netns exec ndppd.1 ip link set ndppd.1 up
ip netns exec ndppd.0 ip -6 addr add dead::1 dev ndppd.0
ip netns exec ndppd.0 ip -6 route add default dev ndppd.0
ip netns exec ndppd.rt ip -6 addr add dead:: dev ndppd.rt0
ip netns exec ndppd.rt ip -6 route add dead::/64 dev ndppd.rt0
ip netns exec ndppd.rt ip -6 addr add dead:1:: dev ndppd.rt1
ip netns exec ndppd.rt ip -6 route add dead:1::/64 dev ndppd.rt1
ip netns exec ndppd.1 ip -6 addr add dead:1::1 dev ndppd.1
ip netns exec ndppd.1 ip -6 route add default dev ndppd.1
ip netns exec ndppd.rt sysctl net.ipv6.conf.all.forwarding=1
;;
"ndppd")
ip netns exec ndppd.rt ./ndppd -c ndppd.test.conf -vvv
;;
"ping0")
ip netns exec ndppd.1 ping -6 dead::1
;;
"ping1")
ip netns exec ndppd.0 ping -6 dead:1::1
;;
esac