Skip to content

Commit 21097b0

Browse files
authored
Merge pull request #2 from jonathanio/feature/ipv6-support
Add IPv6 address support for DNS Servers
2 parents bd8b181 + 75f22dc commit 21097b0

11 files changed

+113
-8
lines changed

run-tests

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ function ip {
7070
_log "ip called with: ${@}"
7171

7272
[[ "${1} ${2} ${3} ${4}" == "link show dev ${dev}" ]] && \
73-
_pass "ip called with correct arguments" || \
74-
_fail "ip called with incorrect or unknown arguments"
73+
_pass "ip was called correctly" || \
74+
_fail "ip was called with incorrect or unknown arguments"
7575

7676
# Return fake ip statement
7777
echo -e "${ip_ifindex}: ${dev}: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP>" \
@@ -127,15 +127,21 @@ for TEST in tests/*.sh; do
127127
# external calls out to system commands
128128
source update-systemd-resolved
129129

130+
[[ ${?} -eq 0 ]] &&
131+
_pass "script exited with a 0 exit status" || \
132+
_fail "script exited with a ${1} exit status"
133+
130134
if [[ ${TEST_BUSCTL_CALLED} -eq 0 ]]; then
131135
[[ ${busctl_called} -eq 0 ]] && \
132136
_pass "busctl was not called, as expected" || \
133137
_fail "busctl was called, not expected"
134138
fi
135139

136140
echo
137-
138141
done
139142

140143
echo -e " ${GREEN}${PASS} ${COUNT_PASS} Passed${RESET}"
141144
echo -e " ${RED}${FAIL} ${COUNT_FAIL} Failed${RESET}"
145+
146+
# Make sure we fail if there are failed tests
147+
[[ ${COUNT_FAIL} -eq 0 ]]

tests/10_single_ipv6_dns_full.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
script_type="up"
2+
dev="tun10"
3+
foreign_option_1="dhcp-option DNS 1234:5678:90ab:cdef:4321:8765:ba09:fedc"
4+
5+
TEST_TITLE="Single IPv6 DNS Server (Full)"
6+
TEST_BUSCTL_CALLED=1
7+
TEST_BUSCTL_DNS="1 2 16 18 52 86 120 144 171 205 239 67 33 135 101 186 9 254 220"
8+
TEST_BUSCTL_DOMAINS=""

tests/11_single_ipv6_dns_simple.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
script_type="up"
2+
dev="tun11"
3+
foreign_option_1="dhcp-option DNS 1234:567:89:0:ab:cde:f123:4567"
4+
5+
TEST_TITLE="Single IPv6 DNS Server (Full, Simple)"
6+
TEST_BUSCTL_CALLED=1
7+
TEST_BUSCTL_DNS="1 2 16 18 52 5 103 0 137 0 0 0 171 12 222 241 35 69 103"
8+
TEST_BUSCTL_DOMAINS=""

tests/12_single_ipv6_dns_compact_1.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
script_type="up"
2+
dev="tun12"
3+
foreign_option_1="dhcp-option DNS 1234:567:89::ab:cde:f123:4567"
4+
5+
TEST_TITLE="Single IPv6 DNS Server (Compact) (Part 1)"
6+
TEST_BUSCTL_CALLED=1
7+
TEST_BUSCTL_DNS="1 2 16 18 52 5 103 0 137 0 0 0 171 12 222 241 35 69 103"
8+
TEST_BUSCTL_DOMAINS=""

tests/13_single_ipv6_dns_compact_2.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
script_type="up"
2+
dev="tun13"
3+
foreign_option_1="dhcp-option DNS 1234:567:89::ab:cdef"
4+
5+
TEST_TITLE="Single IPv6 DNS Server (Compact) (Part 2)"
6+
TEST_BUSCTL_CALLED=1
7+
TEST_BUSCTL_DNS="1 2 16 18 52 5 103 0 137 0 0 0 0 0 0 0 171 205 239"
8+
TEST_BUSCTL_DOMAINS=""

tests/14_single_ipv6_dns_compact_3.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
script_type="up"
2+
dev="tun14"
3+
foreign_option_1="dhcp-option DNS 20a0::1"
4+
5+
TEST_TITLE="Single IPv6 DNS Server (Compact) (Part 3)"
6+
TEST_BUSCTL_CALLED=1
7+
TEST_BUSCTL_DNS="1 2 16 32 160 0 0 0 0 0 0 0 0 0 0 0 0 0 1"
8+
TEST_BUSCTL_DOMAINS=""

tests/15_single_ipv6_dns_localhost.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
script_type="up"
2+
dev="tun15"
3+
foreign_option_1="dhcp-option DNS ::1"
4+
5+
TEST_TITLE="Single IPv6 DNS Server (Localhost)"
6+
TEST_BUSCTL_CALLED=1
7+
TEST_BUSCTL_DNS="1 2 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1"
8+
TEST_BUSCTL_DOMAINS=""

tests/16_dual_ipv6_single_ipv4.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
script_type="up"
2+
dev="tun16"
3+
foreign_option_1="dhcp-option DNS 1234:567:89::ab:cdef"
4+
foreign_option_2="dhcp-option DNS 1.23.4.56"
5+
6+
TEST_TITLE="Single IPv6 and Single IPv4 DNS Servers"
7+
TEST_BUSCTL_CALLED=1
8+
TEST_BUSCTL_DNS="2 2 16 18 52 5 103 0 137 0 0 0 0 0 0 0 171 205 239 2 4 1 23 4 56"
9+
TEST_BUSCTL_DOMAINS=""

tests/17_single_ipv6_single_ipv4.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
script_type="up"
2+
dev="tun17"
3+
foreign_option_1="dhcp-option DNS 1234:567:89::ab:cdef"
4+
foreign_option_2="dhcp-option DNS 1.23.4.56"
5+
foreign_option_3="dhcp-option DNS 20a0::1"
6+
7+
TEST_TITLE="Single IPv6 and Single IPv4 DNS Servers"
8+
TEST_BUSCTL_CALLED=1
9+
TEST_BUSCTL_DNS="3 2 16 18 52 5 103 0 137 0 0 0 0 0 0 0 171 205 239 2 4 1 23 4 56 2 16 32 160 0 0 0 0 0 0 0 0 0 0 0 0 0 1"
10+
TEST_BUSCTL_DOMAINS=""
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
script_type="up"
2+
dev="tun18"
3+
foreign_option_1="dhcp-option DNS 1.23.4.56"
4+
foreign_option_2="dhcp-option DNS 2.34.56.7"
5+
foreign_option_3="dhcp-option DNS 1234:567:89::ab:cdef"
6+
foreign_option_4="dhcp-option DNS 1234:567:89::ba:cdef"
7+
foreign_option_5="dhcp-option DOMAIN example.com"
8+
foreign_option_6="dhcp-option DOMAIN-SEARCH example.co"
9+
10+
TEST_TITLE="DNS IPv4 and IPv6 Servers, plus Domain and Search"
11+
TEST_BUSCTL_CALLED=1
12+
TEST_BUSCTL_DNS="4 2 4 1 23 4 56 2 4 2 34 56 7 2 16 18 52 5 103 0 137 0 0 0 0 0 0 0 171 205 239 2 16 18 52 5 103 0 137 0 0 0 0 0 0 0 186 205 239"
13+
TEST_BUSCTL_DOMAINS="2 example.com false example.co true"

0 commit comments

Comments
 (0)