summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/in6_gif.c
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2003-10-29 15:07:04 +0000
committerume <ume@FreeBSD.org>2003-10-29 15:07:04 +0000
commitb9fecc82d3e55cefb5fd427307272fed377b780a (patch)
treeff2af6160ee3c3b0bf6e218dc2107ae003e82cde /sys/netinet6/in6_gif.c
parentf965698ed4683de29221f38b96189223a4cf0b2e (diff)
downloadFreeBSD-src-b9fecc82d3e55cefb5fd427307272fed377b780a.zip
FreeBSD-src-b9fecc82d3e55cefb5fd427307272fed377b780a.tar.gz
add ECN support in layer-3.
- implement the tunnel egress rule in ip_ecn_egress() in ip_ecn.c. make ip{,6}_ecn_egress() return integer to tell the caller that this packet should be dropped. - handle ECN at fragment reassembly in ip_input.c and frag6.c. Obtained from: KAME
Diffstat (limited to 'sys/netinet6/in6_gif.c')
-rw-r--r--sys/netinet6/in6_gif.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c
index fae8a98..e3cd124 100644
--- a/sys/netinet6/in6_gif.c
+++ b/sys/netinet6/in6_gif.c
@@ -168,11 +168,9 @@ in6_gif_output(ifp, family, m)
m_freem(m);
return ENETUNREACH;
}
- if (ifp->if_flags & IFF_LINK1)
- ip_ecn_ingress(ECN_ALLOWED, &otos, &itos);
- else
- ip_ecn_ingress(ECN_NOCARE, &otos, &itos);
- ip6->ip6_flow &= ~ntohl(0xff00000);
+ ip_ecn_ingress((ifp->if_flags & IFF_LINK1) ? ECN_ALLOWED : ECN_NOCARE,
+ &otos, &itos);
+ ip6->ip6_flow &= ~htonl(0xff << 20);
ip6->ip6_flow |= htonl((u_int32_t)otos << 20);
if (dst->sin6_family != sin6_dst->sin6_family ||
@@ -259,10 +257,12 @@ in6_gif_input(mp, offp, proto)
return IPPROTO_DONE;
}
ip = mtod(m, struct ip *);
- if (gifp->if_flags & IFF_LINK1)
- ip_ecn_egress(ECN_ALLOWED, &otos8, &ip->ip_tos);
- else
- ip_ecn_egress(ECN_NOCARE, &otos8, &ip->ip_tos);
+ if (ip_ecn_egress((gifp->if_flags & IFF_LINK1) ?
+ ECN_ALLOWED : ECN_NOCARE,
+ &otos8, &ip->ip_tos) == 0) {
+ m_freem(m);
+ return IPPROTO_DONE;
+ }
break;
}
#endif /* INET */
@@ -277,10 +277,12 @@ in6_gif_input(mp, offp, proto)
return IPPROTO_DONE;
}
ip6 = mtod(m, struct ip6_hdr *);
- if (gifp->if_flags & IFF_LINK1)
- ip6_ecn_egress(ECN_ALLOWED, &otos, &ip6->ip6_flow);
- else
- ip6_ecn_egress(ECN_NOCARE, &otos, &ip6->ip6_flow);
+ if (ip6_ecn_egress((gifp->if_flags & IFF_LINK1) ?
+ ECN_ALLOWED : ECN_NOCARE,
+ &otos, &ip6->ip6_flow) == 0) {
+ m_freem(m);
+ return IPPROTO_DONE;
+ }
break;
}
#endif
OpenPOWER on IntegriCloud