MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ipsec_ioctl

Function ipsec_ioctl

freebsd/net/if_ipsec.c:519–774  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

517}
518
519static int
520ipsec_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 *)

Callers

nothing calls this directly

Calls 12

sa6_embedscopeFunction · 0.85
ipsec_set_addressesFunction · 0.85
ipsec_delete_tunnelFunction · 0.85
ipsec_getsaidxFunction · 0.85
memsetFunction · 0.85
sa6_recoverscopeFunction · 0.85
ifr_data_get_ptrFunction · 0.85
ipsec_set_reqidFunction · 0.85
prison_ifFunction · 0.50
priv_checkFunction · 0.50
copyoutFunction · 0.50
copyinFunction · 0.50

Tested by

no test coverage detected