1#!/bin/sh
2
3source lib/generic.sh
4
5ts_log "[Testing add default route]"
6
7DEV=dummy0
8
9ts_ip "$0" "Add new interface $DEV" link add $DEV type dummy
10ts_ip "$0" "Set $DEV into UP state" link set up dev $DEV
11
12ts_ip "$0" "Add 1.1.1.1/24 addr on $DEV" addr add 1.1.1.1/24 dev $DEV
13ts_ip "$0" "Add default route via 1.1.1.2" route add default via 1.1.1.2
14
15ts_ip "$0" "Show IPv4 default route" -4 route show default
16test_on "default via 1.1.1.2 dev $DEV"
17test_lines_count 1
18
19ts_ip "$0" "Add another IPv4 route dst 2.2.2.0/24" -4 route add 2.2.2.0/24 dev $DEV
20ts_ip "$0" "Show IPv4 default route" -4 route show default
21test_on "default via 1.1.1.2 dev $DEV"
22test_lines_count 1
23
24ts_ip "$0" "Add dead:beef::1/64 addr on $DEV" -6 addr add dead:beef::1/64 dev $DEV
25ts_ip "$0" "Add default route via dead:beef::2" route add default via dead:beef::2
26ts_ip "$0" "Show IPv6 default route" -6 route show default
27test_on "default via dead:beef::2 dev $DEV"
28test_lines_count 1
29
30ts_ip "$0" "Add another IPv6 route dst cafe:babe::/64" -6 route add cafe:babe::/64 dev $DEV
31ts_ip "$0" "Show IPv6 default route" -6 route show default
32test_on "default via dead:beef::2 dev $DEV"
33test_lines_count 1
34