Lines Matching defs:tunnel
160 * GRE tunnel metadata
755 struct gre_tunnel *tunnel;
784 tunnel = &sc->sc_tunnel;
785 tunnel->t_ttl = IP_DEFAULT_MULTICAST_TTL;
786 tunnel->t_txhprio = 0;
788 tunnel->t_df = htons(IP_DF);
789 tunnel->t_key_mask = GRE_KEY_ENTROPY;
790 tunnel->t_key = htonl((NVGRE_VSID_RES_MAX + 1) <<
1008 const struct gre_tunnel *tunnel;
1091 * GRE tunnel is precisely a IP-in-GRE tunnel that differs
1153 tunnel = ifp->if_softc; /* gre and mgre tunnel info is at the front */
1155 m = (*patch)(tunnel, m, &itos, otos);
1159 if (tunnel->t_key_mask == GRE_KEY_ENTROPY) {
1165 rxprio = tunnel->t_rxhprio;
1192 gre_ipv4_patch(const struct gre_tunnel *tunnel, struct mbuf *m,
1205 if (ip_ecn_egress(tunnel->t_ecn, &otos, &itos) == 0) {
1219 gre_ipv6_patch(const struct gre_tunnel *tunnel, struct mbuf *m,
1234 if (ip_ecn_egress(tunnel->t_ecn, &otos, &itos) == 0) {
1251 gre_mpls_patch(const struct gre_tunnel *tunnel, struct mbuf *m,
1264 if (ip_ecn_egress(tunnel->t_ecn, &otos, &itos) == 0) {
1829 gre_l3_encap_dst(const struct gre_tunnel *tunnel, const void *dst,
1834 int tttl = tunnel->t_ttl;
1899 itos = gre_l3_tos(tunnel, m, itos);
1900 ip_ecn_ingress(tunnel->t_ecn, &otos, &itos);
1902 return (gre_encap_dst(tunnel, dst, m, proto, ttl, otos));
1906 gre_encap_dst(const struct gre_tunnel *tunnel, const union gre_addr *dst,
1914 if (tunnel->t_key_mask != GRE_KEY_NONE)
1924 if (tunnel->t_key_mask != GRE_KEY_NONE) {
1928 gkh->gre_key = tunnel->t_key;
1930 if (tunnel->t_key_mask == GRE_KEY_ENTROPY &&
1937 return (gre_encap_dst_ip(tunnel, dst, m, ttl, tos));
1941 gre_encap_dst_ip(const struct gre_tunnel *tunnel, const union gre_addr *dst,
1944 switch (tunnel->t_af) {
1946 /* packets may arrive before tunnel is set up */
1959 ip->ip_off = tunnel->t_df;
1964 ip->ip_src = tunnel->t_src4;
1985 ip6->ip6_src = tunnel->t_src6;
1988 if (tunnel->t_df)
1995 unhandled_af(tunnel->t_af);
2002 gre_ip_output(const struct gre_tunnel *tunnel, struct mbuf *m)
2005 m->m_pkthdr.ph_rtableid = tunnel->t_rtableid;
2011 switch (tunnel->t_af) {
2021 unhandled_af(tunnel->t_af);
2028 gre_tunnel_ioctl(struct ifnet *ifp, struct gre_tunnel *tunnel,
2047 error = gre_set_vnetid(tunnel, ifr);
2051 error = gre_get_vnetid(tunnel, ifr);
2054 error = gre_del_vnetid(tunnel);
2058 error = gre_set_vnetflowid(tunnel, ifr);
2062 error = gre_get_vnetflowid(tunnel, ifr);
2066 error = gre_set_tunnel(tunnel, (struct if_laddrreq *)data, 1);
2069 error = gre_get_tunnel(tunnel, (struct if_laddrreq *)data);
2072 error = gre_del_tunnel(tunnel);
2082 tunnel->t_rtableid = ifr->ifr_rdomainid;
2085 ifr->ifr_rdomainid = tunnel->t_rtableid;
2090 tunnel->t_df = ifr->ifr_df ? htons(IP_DF) : htons(0);
2093 ifr->ifr_df = tunnel->t_df ? 1 : 0;
2351 struct gre_tunnel *tunnel = &sc->sc_tunnel;
2374 tunnel->t_src4 = addr4->sin_addr;
2375 tunnel->t_dst4.s_addr = INADDR_ANY;
2388 error = in6_embedscope(&tunnel->t_src6, addr6, NULL, NULL);
2392 memset(&tunnel->t_dst6, 0, sizeof(tunnel->t_dst6));
2401 tunnel->t_af = addr->sa_family;
2409 struct gre_tunnel *tunnel = &sc->sc_tunnel;
2416 switch (tunnel->t_af) {
2424 sin->sin_addr = tunnel->t_src4;
2433 in6_recoverscope(sin6, &tunnel->t_src6);
2437 unhandled_af(tunnel->t_af);
2535 struct gre_tunnel *tunnel = &sc->sc_tunnel;
2564 error = gre_set_tunnel(tunnel, (struct if_laddrreq *)data, 0);
2569 error = gre_get_tunnel(tunnel, (struct if_laddrreq *)data);
2576 error = gre_del_tunnel(tunnel);
2622 tunnel->t_key = htonl(ifr->ifr_vnetid << GRE_KEY_ENTROPY_SHIFT);
2626 error = gre_get_vnetid(tunnel, ifr);
2636 tunnel->t_rtableid = ifr->ifr_rdomainid;
2640 ifr->ifr_rdomainid = tunnel->t_rtableid;
2645 tunnel->t_df = ifr->ifr_df ? htons(IP_DF) : htons(0);
2648 ifr->ifr_df = tunnel->t_df ? 1 : 0;
2658 tunnel->t_ttl = ifr->ifr_ttl;
2662 ifr->ifr_ttl = tunnel->t_ttl;
3053 * put it in the tunnel
3079 gre_set_tunnel(struct gre_tunnel *tunnel, struct if_laddrreq *req, int ucast)
3109 tunnel->t_src4 = src4->sin_addr;
3110 tunnel->t_dst4 = dst4->sin_addr;
3131 error = in6_embedscope(&tunnel->t_src6, src6, NULL, NULL);
3135 error = in6_embedscope(&tunnel->t_dst6, dst6, NULL, NULL);
3146 tunnel->t_af = dst->sa_family;
3152 gre_get_tunnel(struct gre_tunnel *tunnel, struct if_laddrreq *req)
3161 switch (tunnel->t_af) {
3169 sin->sin_addr = tunnel->t_src4;
3175 sin->sin_addr = tunnel->t_dst4;
3185 in6_recoverscope(sin6, &tunnel->t_src6);
3191 in6_recoverscope(sin6, &tunnel->t_dst6);
3203 gre_del_tunnel(struct gre_tunnel *tunnel)
3206 tunnel->t_af = AF_UNSPEC;
3212 gre_set_vnetid(struct gre_tunnel *tunnel, struct ifreq *ifr)
3220 if (tunnel->t_key_mask == GRE_KEY_ENTROPY) {
3233 tunnel->t_key_mask = mask;
3234 tunnel->t_key = key;
3240 gre_get_vnetid(struct gre_tunnel *tunnel, struct ifreq *ifr)
3244 switch (tunnel->t_key_mask) {
3255 ifr->ifr_vnetid = ntohl(tunnel->t_key) >> shift;
3261 gre_del_vnetid(struct gre_tunnel *tunnel)
3263 tunnel->t_key_mask = GRE_KEY_NONE;
3269 gre_set_vnetflowid(struct gre_tunnel *tunnel, struct ifreq *ifr)
3273 if (tunnel->t_key_mask == GRE_KEY_NONE)
3277 if (tunnel->t_key_mask == mask) {
3282 key = ntohl(tunnel->t_key);
3292 tunnel->t_key_mask = mask;
3293 tunnel->t_key = key;
3299 gre_get_vnetflowid(struct gre_tunnel *tunnel, struct ifreq *ifr)
3301 if (tunnel->t_key_mask == GRE_KEY_NONE)
3304 ifr->ifr_vnetid = tunnel->t_key_mask == GRE_KEY_ENTROPY;
3405 struct gre_tunnel *tunnel = &sc->sc_tunnel;
3410 if (tunnel->t_af == AF_UNSPEC)
3432 switch (tunnel->t_af) {
3434 inm = in_addmulti(&tunnel->t_dst4, ifp0);
3442 inm = in6_addmulti(&tunnel->t_dst6, ifp0, &error);
3450 unhandled_af(tunnel->t_af);
3475 struct gre_tunnel *tunnel = &sc->sc_tunnel;
3499 switch (tunnel->t_af) {
3510 unhandled_af(tunnel->t_af);
3642 const struct gre_tunnel *tunnel = &sc->sc_tunnel;
3665 gateway = tunnel->t_dst;
3674 endpoint = &tunnel->t_dst;
3693 m = gre_encap_dst(tunnel, &gateway, m,
3695 tunnel->t_ttl, gre_l2_tos(tunnel, m));
3700 m->m_pkthdr.ph_rtableid = tunnel->t_rtableid;