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

Function ipcomp6_nonexp_encapcheck

freebsd/netipsec/xform_ipcomp.c:694–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

692#endif
693#ifdef INET6
694static int
695ipcomp6_nonexp_encapcheck(const struct mbuf *m, int off, int proto,
696 void *arg __unused)
697{
698 union sockaddr_union src, dst;
699 const struct ip6_hdr *ip6;
700
701 if (V_ipcomp_enable == 0)
702 return (0);
703 if (proto != IPPROTO_IPV4 && proto != IPPROTO_IPV6)
704 return (0);
705 bzero(&src, sizeof(src));
706 bzero(&dst, sizeof(dst));
707 src.sa.sa_family = dst.sa.sa_family = AF_INET;
708 src.sin6.sin6_len = dst.sin6.sin6_len = sizeof(struct sockaddr_in6);
709 ip6 = mtod(m, const struct ip6_hdr *);
710 src.sin6.sin6_addr = ip6->ip6_src;
711 dst.sin6.sin6_addr = ip6->ip6_dst;
712 if (IN6_IS_SCOPE_LINKLOCAL(&src.sin6.sin6_addr)) {
713 /* XXX: sa6_recoverscope() */
714 src.sin6.sin6_scope_id =
715 ntohs(src.sin6.sin6_addr.s6_addr16[1]);
716 src.sin6.sin6_addr.s6_addr16[1] = 0;
717 }
718 if (IN6_IS_SCOPE_LINKLOCAL(&dst.sin6.sin6_addr)) {
719 /* XXX: sa6_recoverscope() */
720 dst.sin6.sin6_scope_id =
721 ntohs(dst.sin6.sin6_addr.s6_addr16[1]);
722 dst.sin6.sin6_addr.s6_addr16[1] = 0;
723 }
724 return (ipcomp_encapcheck(&src, &dst));
725}
726
727static const struct encaptab *ipe6_cookie = NULL;
728static const struct encap_config ipv6_encap_cfg = {

Callers

nothing calls this directly

Calls 2

bzeroFunction · 0.85
ipcomp_encapcheckFunction · 0.85

Tested by

no test coverage detected