summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-22 11:28:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-22 11:28:16 -0400
commitf75b6f303bd80249a56cce9028954b4f731270e3 (patch)
tree3efcb909852964382b7b34fc4942a2eee0284a8c /tools
parent86f9e56d08852961a1b9e062d59b71491d8c793a (diff)
parentad70411a978d1e6e97b1e341a7bde9a79af0c93d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Clear up some recent tipc regressions because of registration ordering. Fix from Junwei Hu. 2) tipc's TLV_SET() can read past the end of the supplied buffer during the copy. From Chris Packham. 3) ptp example program doesn't match the kernel, from Richard Cochran. 4) Outgoing message type fix in qrtr, from Bjorn Andersson. 5) Flow control regression in stmmac, from Tan Tee Min. 6) Fix inband autonegotiation in phylink, from Russell King. 7) Fix sk_bound_dev_if handling in rawv6_bind(), from Mike Manning. 8) Fix usbnet crash after disconnect, from Kloetzke Jan. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (21 commits) usbnet: fix kernel crash after disconnect selftests: fib_rule_tests: use pre-defined DEV_ADDR net-next: net: Fix typos in ip-sysctl.txt ipv6: Consider sk_bound_dev_if when binding a raw socket to an address net: phylink: ensure inband AN works correctly usbnet: ipheth: fix racing condition net: stmmac: dma channel control register need to be init first net: stmmac: fix ethtool flow control not able to get/set net: qrtr: Fix message type of outgoing packets networking: : fix typos in code comments ptp: Fix example program to match kernel. fddi: fix typos in code comments selftests: fib_rule_tests: enable forwarding before ipv4 from/iif test selftests: fib_rule_tests: fix local IPv4 address typo tipc: Avoid copying bytes beyond the supplied data 2/2] net: xilinx_emaclite: use readx_poll_timeout() in mdio wait function 1/2] net: axienet: use readx_poll_timeout() in mdio wait function vlan: Mark expected switch fall-through macvlan: Mark expected switch fall-through net/mlx4_en: ethtool, Remove unsupported SFP EEPROM high pages query ...
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/net/fib_rule_tests.sh10
-rw-r--r--tools/testing/selftests/ptp/testptp.c85
2 files changed, 9 insertions, 86 deletions
diff --git a/tools/testing/selftests/net/fib_rule_tests.sh b/tools/testing/selftests/net/fib_rule_tests.sh
index 4b7e107865bf..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
15SRC_IP6=2001:db8:1::3 15SRC_IP6=2001:db8:1::3
16 16
17DEV_ADDR=192.51.100.1 17DEV_ADDR=192.51.100.1
18DEV_ADDR6=2001:db8:1::1
18DEV=dummy0 19DEV=dummy0
19 20
20log_test() 21log_test()
@@ -55,8 +56,8 @@ setup()
55 56
56 $IP link add dummy0 type dummy 57 $IP link add dummy0 type dummy
57 $IP link set dev dummy0 up 58 $IP link set dev dummy0 up
58 $IP address add 198.51.100.1/24 dev dummy0 59 $IP address add $DEV_ADDR/24 dev dummy0
59 $IP -6 address add 2001:db8:1::1/64 dev dummy0 60 $IP -6 address add $DEV_ADDR6/64 dev dummy0
60 61
61 set +e 62 set +e
62} 63}
@@ -186,8 +187,13 @@ fib_rule4_test()
186 match="oif $DEV" 187 match="oif $DEV"
187 fib_rule4_test_match_n_redirect "$match" "$match" "oif redirect to table" 188 fib_rule4_test_match_n_redirect "$match" "$match" "oif redirect to table"
188 189
190 # need enable forwarding and disable rp_filter temporarily as all the
191 # addresses are in the same subnet and egress device == ingress device.
192 ip netns exec testns sysctl -w net.ipv4.ip_forward=1
193 ip netns exec testns sysctl -w net.ipv4.conf.$DEV.rp_filter=0
189 match="from $SRC_IP iif $DEV" 194 match="from $SRC_IP iif $DEV"
190 fib_rule4_test_match_n_redirect "$match" "$match" "iif redirect to table" 195 fib_rule4_test_match_n_redirect "$match" "$match" "iif redirect to table"
196 ip netns exec testns sysctl -w net.ipv4.ip_forward=0
191 197
192 match="tos 0x10" 198 match="tos 0x10"
193 fib_rule4_test_match_n_redirect "$match" "$match" "tos redirect to table" 199 fib_rule4_test_match_n_redirect "$match" "$match" "tos redirect to table"
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)
63 return (((unsigned int) ~fd) << 3) | CLOCKFD; 63 return (((unsigned int) ~fd) << 3) | CLOCKFD;
64} 64}
65 65
66static void handle_alarm(int s)
67{
68 printf("received signal %d\n", s);
69}
70
71static int install_handler(int signum, void (*handler)(int))
72{
73 struct sigaction action;
74 sigset_t mask;
75
76 /* Unblock the signal. */
77 sigemptyset(&mask);
78 sigaddset(&mask, signum);
79 sigprocmask(SIG_UNBLOCK, &mask, NULL);
80
81 /* Install the signal handler. */
82 action.sa_handler = handler;
83 action.sa_flags = 0;
84 sigemptyset(&action.sa_mask);
85 sigaction(signum, &action, NULL);
86
87 return 0;
88}
89
90static long ppb_to_scaled_ppm(int ppb) 66static long ppb_to_scaled_ppm(int ppb)
91{ 67{
92 /* 68 /*
@@ -112,8 +88,6 @@ static void usage(char *progname)
112{ 88{
113 fprintf(stderr, 89 fprintf(stderr,
114 "usage: %s [options]\n" 90 "usage: %s [options]\n"
115 " -a val request a one-shot alarm after 'val' seconds\n"
116 " -A val request a periodic alarm every 'val' seconds\n"
117 " -c query the ptp clock's capabilities\n" 91 " -c query the ptp clock's capabilities\n"
118 " -d name device to open\n" 92 " -d name device to open\n"
119 " -e val read 'val' external time stamp events\n" 93 " -e val read 'val' external time stamp events\n"
@@ -148,15 +122,9 @@ int main(int argc, char *argv[])
148 struct ptp_pin_desc desc; 122 struct ptp_pin_desc desc;
149 struct timespec ts; 123 struct timespec ts;
150 struct timex tx; 124 struct timex tx;
151
152 static timer_t timerid;
153 struct itimerspec timeout;
154 struct sigevent sigevent;
155
156 struct ptp_clock_time *pct; 125 struct ptp_clock_time *pct;
157 struct ptp_sys_offset *sysoff; 126 struct ptp_sys_offset *sysoff;
158 127
159
160 char *progname; 128 char *progname;
161 unsigned int i; 129 unsigned int i;
162 int c, cnt, fd; 130 int c, cnt, fd;
@@ -170,10 +138,8 @@ int main(int argc, char *argv[])
170 int gettime = 0; 138 int gettime = 0;
171 int index = 0; 139 int index = 0;
172 int list_pins = 0; 140 int list_pins = 0;
173 int oneshot = 0;
174 int pct_offset = 0; 141 int pct_offset = 0;
175 int n_samples = 0; 142 int n_samples = 0;
176 int periodic = 0;
177 int perout = -1; 143 int perout = -1;
178 int pin_index = -1, pin_func; 144 int pin_index = -1, pin_func;
179 int pps = -1; 145 int pps = -1;
@@ -185,14 +151,8 @@ int main(int argc, char *argv[])
185 151
186 progname = strrchr(argv[0], '/'); 152 progname = strrchr(argv[0], '/');
187 progname = progname ? 1+progname : argv[0]; 153 progname = progname ? 1+progname : argv[0];
188 while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghi:k:lL:p:P:sSt:T:v"))) { 154 while (EOF != (c = getopt(argc, argv, "cd:e:f:ghi:k:lL:p:P:sSt:T:v"))) {
189 switch (c) { 155 switch (c) {
190 case 'a':
191 oneshot = atoi(optarg);
192 break;
193 case 'A':
194 periodic = atoi(optarg);
195 break;
196 case 'c': 156 case 'c':
197 capabilities = 1; 157 capabilities = 1;
198 break; 158 break;
@@ -393,49 +353,6 @@ int main(int argc, char *argv[])
393 } 353 }
394 } 354 }
395 355
396 if (oneshot) {
397 install_handler(SIGALRM, handle_alarm);
398 /* Create a timer. */
399 sigevent.sigev_notify = SIGEV_SIGNAL;
400 sigevent.sigev_signo = SIGALRM;
401 if (timer_create(clkid, &sigevent, &timerid)) {
402 perror("timer_create");
403 return -1;
404 }
405 /* Start the timer. */
406 memset(&timeout, 0, sizeof(timeout));
407 timeout.it_value.tv_sec = oneshot;
408 if (timer_settime(timerid, 0, &timeout, NULL)) {
409 perror("timer_settime");
410 return -1;
411 }
412 pause();
413 timer_delete(timerid);
414 }
415
416 if (periodic) {
417 install_handler(SIGALRM, handle_alarm);
418 /* Create a timer. */
419 sigevent.sigev_notify = SIGEV_SIGNAL;
420 sigevent.sigev_signo = SIGALRM;
421 if (timer_create(clkid, &sigevent, &timerid)) {
422 perror("timer_create");
423 return -1;
424 }
425 /* Start the timer. */
426 memset(&timeout, 0, sizeof(timeout));
427 timeout.it_interval.tv_sec = periodic;
428 timeout.it_value.tv_sec = periodic;
429 if (timer_settime(timerid, 0, &timeout, NULL)) {
430 perror("timer_settime");
431 return -1;
432 }
433 while (1) {
434 pause();
435 }
436 timer_delete(timerid);
437 }
438
439 if (perout >= 0) { 356 if (perout >= 0) {
440 if (clock_gettime(clkid, &ts)) { 357 if (clock_gettime(clkid, &ts)) {
441 perror("clock_gettime"); 358 perror("clock_gettime");