* Check that ingress address belongs to local host. */
| 777 | * Check that ingress address belongs to local host. |
| 778 | */ |
| 779 | static void |
| 780 | ipsec_set_running(struct ipsec_softc *sc) |
| 781 | { |
| 782 | struct secasindex *saidx; |
| 783 | int localip; |
| 784 | |
| 785 | saidx = ipsec_getsaidx(sc, IPSEC_DIR_OUTBOUND, sc->family); |
| 786 | localip = 0; |
| 787 | switch (sc->family) { |
| 788 | #ifdef INET |
| 789 | case AF_INET: |
| 790 | localip = in_localip(saidx->src.sin.sin_addr); |
| 791 | break; |
| 792 | #endif |
| 793 | #ifdef INET6 |
| 794 | case AF_INET6: |
| 795 | localip = in6_localip(&saidx->src.sin6.sin6_addr); |
| 796 | break; |
| 797 | #endif |
| 798 | } |
| 799 | if (localip != 0) |
| 800 | sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; |
| 801 | else |
| 802 | sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; |
| 803 | } |
| 804 | |
| 805 | /* |
| 806 | * ifaddr_event handler. |
no test coverage detected