Commit 50ab7a3
committed
Do not modify --bind and --client arguments inplace
Do as iperf_parse_hostname()'s comment says already: pass a copy of
getopt(3)'s `optarg` aka. to avoid strtok(3) scribbling over `argv[]`.
Otherwise arguments like "fe80::1%vport0" appear as "fe80::1" in the
process list and cause exact matching of process name and arguments
(against what was used) to fail.
OpenBSD's net/iperf3 package ships a rc.subr(8) script and the service
framework uses pgrep(1) to check for running processes, where this
bug causes a mismatch due to the scope identifier being stripped:
```
$ rcctl get iperf3 flags
-6 --bind fe80::1%vport0
$ rcctl check iperf3
iperf3(failed)
$ pgrep -fl iperf3
33091 /usr/local/bin/iperf3 -s -D -6 -B fe80::1
```
Pass a copy to avoid modification, thus fixing rcctl(8) reporting:
```
$ rcctl check iperf3
iperf3(ok)
$ pgrep -fl iperf3
98863 /usr/local/bin/iperf3 -s -D -6 -B fe80::1%vport0
```1 parent 4b370dd commit 50ab7a3
1 file changed
+12
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1289 | 1289 | | |
1290 | 1290 | | |
1291 | 1291 | | |
1292 | | - | |
| 1292 | + | |
1293 | 1293 | | |
1294 | 1294 | | |
1295 | 1295 | | |
1296 | 1296 | | |
1297 | 1297 | | |
1298 | 1298 | | |
1299 | 1299 | | |
1300 | | - | |
| 1300 | + | |
| 1301 | + | |
1301 | 1302 | | |
1302 | 1303 | | |
1303 | 1304 | | |
1304 | 1305 | | |
1305 | 1306 | | |
1306 | 1307 | | |
| 1308 | + | |
1307 | 1309 | | |
1308 | 1310 | | |
1309 | 1311 | | |
1310 | 1312 | | |
| 1313 | + | |
1311 | 1314 | | |
| 1315 | + | |
1312 | 1316 | | |
1313 | 1317 | | |
1314 | 1318 | | |
| |||
1441 | 1445 | | |
1442 | 1446 | | |
1443 | 1447 | | |
1444 | | - | |
| 1448 | + | |
1445 | 1449 | | |
1446 | 1450 | | |
1447 | | - | |
| 1451 | + | |
| 1452 | + | |
1448 | 1453 | | |
1449 | 1454 | | |
1450 | 1455 | | |
1451 | 1456 | | |
1452 | 1457 | | |
1453 | 1458 | | |
| 1459 | + | |
1454 | 1460 | | |
1455 | 1461 | | |
1456 | 1462 | | |
1457 | 1463 | | |
| 1464 | + | |
1458 | 1465 | | |
| 1466 | + | |
1459 | 1467 | | |
1460 | 1468 | | |
1461 | 1469 | | |
| |||
0 commit comments