ARGSUSED */
| 1330 | |
| 1331 | /* ARGSUSED */ |
| 1332 | static int |
| 1333 | pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data) |
| 1334 | { |
| 1335 | struct pfsync_softc *sc = ifp->if_softc; |
| 1336 | struct ifreq *ifr = (struct ifreq *)data; |
| 1337 | struct pfsyncreq pfsyncr; |
| 1338 | int error; |
| 1339 | int c; |
| 1340 | |
| 1341 | switch (cmd) { |
| 1342 | case SIOCSIFFLAGS: |
| 1343 | PFSYNC_LOCK(sc); |
| 1344 | if (ifp->if_flags & IFF_UP) { |
| 1345 | ifp->if_drv_flags |= IFF_DRV_RUNNING; |
| 1346 | PFSYNC_UNLOCK(sc); |
| 1347 | pfsync_pointers_init(); |
| 1348 | } else { |
| 1349 | ifp->if_drv_flags &= ~IFF_DRV_RUNNING; |
| 1350 | PFSYNC_UNLOCK(sc); |
| 1351 | pfsync_pointers_uninit(); |
| 1352 | } |
| 1353 | break; |
| 1354 | case SIOCSIFMTU: |
| 1355 | if (!sc->sc_sync_if || |
| 1356 | ifr->ifr_mtu <= PFSYNC_MINPKT || |
| 1357 | ifr->ifr_mtu > sc->sc_sync_if->if_mtu) |
| 1358 | return (EINVAL); |
| 1359 | if (ifr->ifr_mtu < ifp->if_mtu) { |
| 1360 | for (c = 0; c < pfsync_buckets; c++) { |
| 1361 | PFSYNC_BUCKET_LOCK(&sc->sc_buckets[c]); |
| 1362 | if (sc->sc_buckets[c].b_len > PFSYNC_MINPKT) |
| 1363 | pfsync_sendout(1, c); |
| 1364 | PFSYNC_BUCKET_UNLOCK(&sc->sc_buckets[c]); |
| 1365 | } |
| 1366 | } |
| 1367 | ifp->if_mtu = ifr->ifr_mtu; |
| 1368 | break; |
| 1369 | case SIOCGETPFSYNC: |
| 1370 | bzero(&pfsyncr, sizeof(pfsyncr)); |
| 1371 | PFSYNC_LOCK(sc); |
| 1372 | if (sc->sc_sync_if) { |
| 1373 | strlcpy(pfsyncr.pfsyncr_syncdev, |
| 1374 | sc->sc_sync_if->if_xname, IFNAMSIZ); |
| 1375 | } |
| 1376 | pfsyncr.pfsyncr_syncpeer = sc->sc_sync_peer; |
| 1377 | pfsyncr.pfsyncr_maxupdates = sc->sc_maxupdates; |
| 1378 | pfsyncr.pfsyncr_defer = (PFSYNCF_DEFER == |
| 1379 | (sc->sc_flags & PFSYNCF_DEFER)); |
| 1380 | PFSYNC_UNLOCK(sc); |
| 1381 | return (copyout(&pfsyncr, ifr_data_get_ptr(ifr), |
| 1382 | sizeof(pfsyncr))); |
| 1383 | |
| 1384 | case SIOCSETPFSYNC: |
| 1385 | { |
| 1386 | struct in_mfilter *imf = NULL; |
| 1387 | struct ifnet *sifp; |
| 1388 | struct ip *ip; |
| 1389 |
nothing calls this directly
no test coverage detected