From fc82d93e57e3d41f79eff19031588b262fc3d0b6 Mon Sep 17 00:00:00 2001 From: Hangbin Liu Date: Mon, 20 May 2019 12:36:54 +0800 Subject: selftests: fib_rule_tests: fix local IPv4 address typo The IPv4 testing address are all in 192.51.100.0 subnet. It doesn't make sense to set a 198.51.100.1 local address. Should be a typo. Fixes: 65b2b4939a64 ("selftests: net: initial fib rule tests") Signed-off-by: Hangbin Liu Reviewed-by: David Ahern Signed-off-by: David S. Miller --- tools/testing/selftests/net/fib_rule_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/testing/selftests/net/fib_rule_tests.sh b/tools/testing/selftests/net/fib_rule_tests.sh index 4b7e107865bf..1ba069967fa2 100755 --- a/tools/testing/selftests/net/fib_rule_tests.sh +++ b/tools/testing/selftests/net/fib_rule_tests.sh @@ -55,7 +55,7 @@ setup() $IP link add dummy0 type dummy $IP link set dev dummy0 up - $IP address add 198.51.100.1/24 dev dummy0 + $IP address add 192.51.100.1/24 dev dummy0 $IP -6 address add 2001:db8:1::1/64 dev dummy0 set +e -- cgit v1.2.3-59-g8ed1b From d1abf388604fffd0386ba0e4204d84451a7de9c2 Mon Sep 17 00:00:00 2001 From: Hangbin Liu Date: Mon, 20 May 2019 12:36:55 +0800 Subject: selftests: fib_rule_tests: enable forwarding before ipv4 from/iif test As all the testing addresses are in the same subnet and egress device == ingress device. We need enable forwarding to get the route entry. Also disable rp_filer separately as some distributions enable it in startup scripts. Fixes: 65b2b4939a64 ("selftests: net: initial fib rule tests") Signed-off-by: Hangbin Liu Signed-off-by: David S. Miller --- tools/testing/selftests/net/fib_rule_tests.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tools') diff --git a/tools/testing/selftests/net/fib_rule_tests.sh b/tools/testing/selftests/net/fib_rule_tests.sh index 1ba069967fa2..617321d3b801 100755 --- a/tools/testing/selftests/net/fib_rule_tests.sh +++ b/tools/testing/selftests/net/fib_rule_tests.sh @@ -186,8 +186,13 @@ fib_rule4_test() match="oif $DEV" fib_rule4_test_match_n_redirect "$match" "$match" "oif redirect to table" + # need enable forwarding and disable rp_filter temporarily as all the + # addresses are in the same subnet and egress device == ingress device. + ip netns exec testns sysctl -w net.ipv4.ip_forward=1 + ip netns exec testns sysctl -w net.ipv4.conf.$DEV.rp_filter=0 match="from $SRC_IP iif $DEV" fib_rule4_test_match_n_redirect "$match" "$match" "iif redirect to table" + ip netns exec testns sysctl -w net.ipv4.ip_forward=0 match="tos 0x10" fib_rule4_test_match_n_redirect "$match" "$match" "tos redirect to table" -- cgit v1.2.3-59-g8ed1b From e3d8e588c7cb185759994e22953e599a918e3cc3 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 19 May 2019 22:15:05 -0700 Subject: ptp: Fix example program to match kernel. Ever since commit 3a06c7ac24f9 ("posix-clocks: Remove interval timer facility and mmap/fasync callbacks") the possibility of PHC based posix timers has been removed. In addition it will probably never make sense to implement this functionality. This patch removes the misleading example code which seems to suggest that posix timers for PHC devices will ever be a thing. Signed-off-by: Richard Cochran Signed-off-by: David S. Miller --- tools/testing/selftests/ptp/testptp.c | 85 +---------------------------------- 1 file changed, 1 insertion(+), 84 deletions(-) (limited to 'tools') diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c index a5d8f0ab0da0..6216375cb544 100644 --- a/tools/testing/selftests/ptp/testptp.c +++ b/tools/testing/selftests/ptp/testptp.c @@ -63,30 +63,6 @@ static clockid_t get_clockid(int fd) return (((unsigned int) ~fd) << 3) | CLOCKFD; } -static void handle_alarm(int s) -{ - printf("received signal %d\n", s); -} - -static int install_handler(int signum, void (*handler)(int)) -{ - struct sigaction action; - sigset_t mask; - - /* Unblock the signal. */ - sigemptyset(&mask); - sigaddset(&mask, signum); - sigprocmask(SIG_UNBLOCK, &mask, NULL); - - /* Install the signal handler. */ - action.sa_handler = handler; - action.sa_flags = 0; - sigemptyset(&action.sa_mask); - sigaction(signum, &action, NULL); - - return 0; -} - static long ppb_to_scaled_ppm(int ppb) { /* @@ -112,8 +88,6 @@ static void usage(char *progname) { fprintf(stderr, "usage: %s [options]\n" - " -a val request a one-shot alarm after 'val' seconds\n" - " -A val request a periodic alarm every 'val' seconds\n" " -c query the ptp clock's capabilities\n" " -d name device to open\n" " -e val read 'val' external time stamp events\n" @@ -148,15 +122,9 @@ int main(int argc, char *argv[]) struct ptp_pin_desc desc; struct timespec ts; struct timex tx; - - static timer_t timerid; - struct itimerspec timeout; - struct sigevent sigevent; - struct ptp_clock_time *pct; struct ptp_sys_offset *sysoff; - char *progname; unsigned int i; int c, cnt, fd; @@ -170,10 +138,8 @@ int main(int argc, char *argv[]) int gettime = 0; int index = 0; int list_pins = 0; - int oneshot = 0; int pct_offset = 0; int n_samples = 0; - int periodic = 0; int perout = -1; int pin_index = -1, pin_func; int pps = -1; @@ -185,14 +151,8 @@ int main(int argc, char *argv[]) progname = strrchr(argv[0], '/'); progname = progname ? 1+progname : argv[0]; - while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghi:k:lL:p:P:sSt:T:v"))) { + while (EOF != (c = getopt(argc, argv, "cd:e:f:ghi:k:lL:p:P:sSt:T:v"))) { switch (c) { - case 'a': - oneshot = atoi(optarg); - break; - case 'A': - periodic = atoi(optarg); - break; case 'c': capabilities = 1; break; @@ -393,49 +353,6 @@ int main(int argc, char *argv[]) } } - if (oneshot) { - install_handler(SIGALRM, handle_alarm); - /* Create a timer. */ - sigevent.sigev_notify = SIGEV_SIGNAL; - sigevent.sigev_signo = SIGALRM; - if (timer_create(clkid, &sigevent, &timerid)) { - perror("timer_create"); - return -1; - } - /* Start the timer. */ - memset(&timeout, 0, sizeof(timeout)); - timeout.it_value.tv_sec = oneshot; - if (timer_settime(timerid, 0, &timeout, NULL)) { - perror("timer_settime"); - return -1; - } - pause(); - timer_delete(timerid); - } - - if (periodic) { - install_handler(SIGALRM, handle_alarm); - /* Create a timer. */ - sigevent.sigev_notify = SIGEV_SIGNAL; - sigevent.sigev_signo = SIGALRM; - if (timer_create(clkid, &sigevent, &timerid)) { - perror("timer_create"); - return -1; - } - /* Start the timer. */ - memset(&timeout, 0, sizeof(timeout)); - timeout.it_interval.tv_sec = periodic; - timeout.it_value.tv_sec = periodic; - if (timer_settime(timerid, 0, &timeout, NULL)) { - perror("timer_settime"); - return -1; - } - while (1) { - pause(); - } - timer_delete(timerid); - } - if (perout >= 0) { if (clock_gettime(clkid, &ts)) { perror("clock_gettime"); -- cgit v1.2.3-59-g8ed1b From 34632975cafdd07ce80e85c2eda4e9c16b5f2faa Mon Sep 17 00:00:00 2001 From: Hangbin Liu Date: Tue, 21 May 2019 14:40:47 +0800 Subject: selftests: fib_rule_tests: use pre-defined DEV_ADDR DEV_ADDR is defined but not used. Use it in address setting. Do the same with IPv6 for consistency. Reported-by: David Ahern Fixes: fc82d93e57e3 ("selftests: fib_rule_tests: fix local IPv4 address typo") Signed-off-by: Hangbin Liu Signed-off-by: David S. Miller --- tools/testing/selftests/net/fib_rule_tests.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/testing/selftests/net/fib_rule_tests.sh b/tools/testing/selftests/net/fib_rule_tests.sh index 617321d3b801..a93e6b690e06 100755 --- a/tools/testing/selftests/net/fib_rule_tests.sh +++ b/tools/testing/selftests/net/fib_rule_tests.sh @@ -15,6 +15,7 @@ GW_IP6=2001:db8:1::2 SRC_IP6=2001:db8:1::3 DEV_ADDR=192.51.100.1 +DEV_ADDR6=2001:db8:1::1 DEV=dummy0 log_test() @@ -55,8 +56,8 @@ setup() $IP link add dummy0 type dummy $IP link set dev dummy0 up - $IP address add 192.51.100.1/24 dev dummy0 - $IP -6 address add 2001:db8:1::1/64 dev dummy0 + $IP address add $DEV_ADDR/24 dev dummy0 + $IP -6 address add $DEV_ADDR6/64 dev dummy0 set +e } -- cgit v1.2.3-59-g8ed1b