| 517 | } |
| 518 | |
| 519 | static int |
| 520 | ipsec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) |
| 521 | { |
| 522 | struct ifreq *ifr = (struct ifreq*)data; |
| 523 | struct sockaddr *dst, *src; |
| 524 | struct ipsec_softc *sc; |
| 525 | struct secasindex *saidx; |
| 526 | #ifdef INET |
| 527 | struct sockaddr_in *sin = NULL; |
| 528 | #endif |
| 529 | #ifdef INET6 |
| 530 | struct sockaddr_in6 *sin6 = NULL; |
| 531 | #endif |
| 532 | uint32_t reqid; |
| 533 | int error; |
| 534 | |
| 535 | switch (cmd) { |
| 536 | case SIOCSIFADDR: |
| 537 | ifp->if_flags |= IFF_UP; |
| 538 | case SIOCADDMULTI: |
| 539 | case SIOCDELMULTI: |
| 540 | case SIOCGIFMTU: |
| 541 | case SIOCSIFFLAGS: |
| 542 | return (0); |
| 543 | case SIOCSIFMTU: |
| 544 | if (ifr->ifr_mtu < IPSEC_MTU_MIN || |
| 545 | ifr->ifr_mtu > IPSEC_MTU_MAX) |
| 546 | return (EINVAL); |
| 547 | else |
| 548 | ifp->if_mtu = ifr->ifr_mtu; |
| 549 | return (0); |
| 550 | } |
| 551 | sx_xlock(&ipsec_ioctl_sx); |
| 552 | sc = ifp->if_softc; |
| 553 | /* Check that softc is still here */ |
| 554 | if (sc == NULL) { |
| 555 | error = ENXIO; |
| 556 | goto bad; |
| 557 | } |
| 558 | error = 0; |
| 559 | switch (cmd) { |
| 560 | case SIOCSIFPHYADDR: |
| 561 | #ifdef INET6 |
| 562 | case SIOCSIFPHYADDR_IN6: |
| 563 | #endif |
| 564 | error = EINVAL; |
| 565 | switch (cmd) { |
| 566 | #ifdef INET |
| 567 | case SIOCSIFPHYADDR: |
| 568 | src = (struct sockaddr *) |
| 569 | &(((struct in_aliasreq *)data)->ifra_addr); |
| 570 | dst = (struct sockaddr *) |
| 571 | &(((struct in_aliasreq *)data)->ifra_dstaddr); |
| 572 | break; |
| 573 | #endif |
| 574 | #ifdef INET6 |
| 575 | case SIOCSIFPHYADDR_IN6: |
| 576 | src = (struct sockaddr *) |
nothing calls this directly
no test coverage detected