Only in syssrc-021116ts-xcast6/sys/arch/i386/conf: GENERIC_XCAST6 Only in syssrc-021116ts-xcast6/sys/arch/i386/conf: GENERIC_XCAST6.orig diff -ur syssrc-021116ts/sys/conf/files syssrc-021116ts-xcast6/sys/conf/files --- syssrc-021116ts/sys/conf/files Wed Nov 13 08:40:19 2002 +++ syssrc-021116ts-xcast6/sys/conf/files Sat Nov 30 16:30:48 2002 @@ -110,6 +110,8 @@ # defflag GATEWAY +defflag opt_xcast6.h XCAST6 + defparam SB_MAX # UVM options @@ -929,6 +931,8 @@ defpseudo gif: ifnet defpseudo faith: ifnet defpseudo stf: ifnet +defpseudo xcst: ifnet + defpseudo sequencer defpseudo clockctl Only in syssrc-021116ts-xcast6/sys/conf: files.orig diff -ur syssrc-021116ts/sys/netinet/udp_usrreq.c syssrc-021116ts-xcast6/sys/netinet/udp_usrreq.c --- syssrc-021116ts/sys/netinet/udp_usrreq.c Wed Aug 14 09:23:36 2002 +++ syssrc-021116ts-xcast6/sys/netinet/udp_usrreq.c Sat Nov 30 16:28:38 2002 @@ -71,6 +71,7 @@ #include "opt_ipsec.h" #include "opt_inet_csum.h" #include "opt_ipkdb.h" +#include "opt_xcast6.h" #include #include @@ -104,6 +105,9 @@ #include #include #include +#ifdef XCAST6 +#include +#endif #endif #ifdef PULLDOWN_TEST @@ -394,6 +398,9 @@ struct ip6_hdr *ip6; struct udphdr *uh; u_int32_t plen, ulen; +#ifdef XCAST6_DESTOPT + u_int16_t dport; +#endif #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, sizeof(struct udphdr), IPPROTO_DONE); @@ -435,9 +442,25 @@ goto bad; } +#ifndef XCAST6_DESTOPT /* destination port of 0 is illegal, based on RFC768. */ if (uh->uh_dport == 0) goto bad; +#else + dport = uh->uh_dport; + + if (xcast6_enable) { + xcast6_ctl_t *x6c; + + x6c = xcast6_getctl(*mp); + if (x6c != NULL && x6c->x6c_port != 0) + dport = x6c->x6c_port; + } + + /* destination port of 0 is illegal, based on RFC768. */ + if (dport == 0) + goto bad; +#endif /* Be proactive about malicious use of IPv4 mapped address */ if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || @@ -471,7 +494,11 @@ dst.sin6_len = sizeof(struct sockaddr_in6); /* KAME hack: recover scopeid */ (void)in6_recoverscope(&dst, &ip6->ip6_dst, m->m_pkthdr.rcvif); +#ifndef XCAST6_DESTOPT dst.sin6_port = uh->uh_dport; +#else + dst.sin6_port = dport; +#endif if (udp6_realinput(AF_INET6, &src, &dst, m, off) == 0) { if (m->m_flags & M_MCAST) { Only in syssrc-021116ts-xcast6/sys/netinet: udp_usrreq.c.orig diff -ur syssrc-021116ts/sys/netinet6/dest6.c syssrc-021116ts-xcast6/sys/netinet6/dest6.c --- syssrc-021116ts/sys/netinet6/dest6.c Tue Nov 13 09:56:56 2001 +++ syssrc-021116ts-xcast6/sys/netinet6/dest6.c Sat Nov 30 16:28:38 2002 @@ -33,6 +33,8 @@ #include __KERNEL_RCSID(0, "$NetBSD: dest6.c,v 1.11 2001/11/13 00:56:56 lukem Exp $"); +#include "opt_xcast6.h" + #include #include #include @@ -53,6 +55,9 @@ #include #include #include +#ifdef XCAST6 +#include +#endif /* * Destination options header processing. @@ -105,6 +110,18 @@ case IP6OPT_PADN: optlen = *(opt + 1) + 2; break; +#ifdef XCAST6_DESTOPT + case IP6OPT_TYPE_XCAST6: + if (!xcast6_enable) + goto fakeunknown; + + if (xcast6_process_destopts(m, opt, &optlen) < 0) + return IPPROTO_DONE; + break; + +fakeunknown: + /*FALLTHROUGH*/ +#endif default: /* unknown option */ optlen = ip6_unknown_opt(opt, m, opt - mtod(m, u_int8_t *)); Only in syssrc-021116ts-xcast6/sys/netinet6: dest6.c.orig diff -ur syssrc-021116ts/sys/netinet6/files.netinet6 syssrc-021116ts-xcast6/sys/netinet6/files.netinet6 --- syssrc-021116ts/sys/netinet6/files.netinet6 Fri Oct 11 07:45:46 2002 +++ syssrc-021116ts-xcast6/sys/netinet6/files.netinet6 Sat Nov 30 16:33:16 2002 @@ -24,3 +24,6 @@ file netinet6/udp6_output.c inet6 file netinet6/udp6_usrreq.c inet6 +file netinet6/xcast6.c xcast6 +file netinet6/if_xcst.c xcst needs-count + diff -ur syssrc-021116ts/sys/netinet6/icmp6.c syssrc-021116ts-xcast6/sys/netinet6/icmp6.c --- syssrc-021116ts/sys/netinet6/icmp6.c Sat Sep 28 00:37:52 2002 +++ syssrc-021116ts-xcast6/sys/netinet6/icmp6.c Sat Nov 30 16:28:38 2002 @@ -70,6 +70,7 @@ #include "opt_inet.h" #include "opt_ipsec.h" +#include "opt_xcast6.h" #include #include @@ -105,6 +106,10 @@ #include #endif +#ifdef XCAST6 +#include +#endif + #include "faith.h" #if defined(NFAITH) && 0 < NFAITH #include @@ -301,12 +306,26 @@ * in the option type field. This check has been done in * ip6_unknown_opt(), so we can just check the type and code. */ +#ifdef XCAST6 + if ((m->m_flags & (M_BCAST|M_MCAST) || + IN6_IS_ADDR_MULTICAST(&oip6->ip6_dst)) && + (type != ICMP6_PACKET_TOO_BIG && + (type != ICMP6_PARAM_PROB || + code != ICMP6_PARAMPROB_OPTION))) { + if (! xcast6_enable) { + goto freeit; + } else if (! xcast6_isreflectable(m, 1)) { + goto freeit; + } + } +#else if ((m->m_flags & (M_BCAST|M_MCAST) || IN6_IS_ADDR_MULTICAST(&oip6->ip6_dst)) && (type != ICMP6_PACKET_TOO_BIG && (type != ICMP6_PARAM_PROB || code != ICMP6_PARAMPROB_OPTION))) goto freeit; +#endif /* * RFC 2463, 2.4 (e.5): source address check. @@ -579,6 +598,10 @@ icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_echo); if (code != 0) goto badcode; +#ifdef XCAST6 + if (xcast6_enable && !xcast6_isreflectable(m, 0)) + goto freeit; +#endif /* * Copy mbuf to send to two data paths: userland socket(s), * and to the querier (echo reply). Only in syssrc-021116ts-xcast6/sys/netinet6: icmp6.c.orig Only in syssrc-021116ts-xcast6/sys/netinet6: if_xcst.c Only in syssrc-021116ts-xcast6/sys/netinet6: if_xcst.c.orig Only in syssrc-021116ts-xcast6/sys/netinet6: if_xcst.h Only in syssrc-021116ts-xcast6/sys/netinet6: if_xcst.h.orig diff -ur syssrc-021116ts/sys/netinet6/in6.h syssrc-021116ts-xcast6/sys/netinet6/in6.h --- syssrc-021116ts/sys/netinet6/in6.h Sun Jun 9 06:22:31 2002 +++ syssrc-021116ts-xcast6/sys/netinet6/in6.h Sat Nov 30 16:28:38 2002 @@ -479,7 +479,7 @@ { 0, 0 }, \ { "ip6", CTLTYPE_NODE }, \ { 0, 0 }, \ - { 0, 0 }, \ + { "route6", CTLTYPE_NODE }, \ { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, \ Only in syssrc-021116ts-xcast6/sys/netinet6: in6.h.orig diff -ur syssrc-021116ts/sys/netinet6/in6_proto.c syssrc-021116ts-xcast6/sys/netinet6/in6_proto.c --- syssrc-021116ts/sys/netinet6/in6_proto.c Tue Nov 12 03:26:42 2002 +++ syssrc-021116ts-xcast6/sys/netinet6/in6_proto.c Sat Nov 30 16:28:38 2002 @@ -71,6 +71,7 @@ #include "opt_inet.h" #include "opt_ipsec.h" #include "opt_iso.h" +#include "opt_xcast6.h" #include #include @@ -119,8 +120,17 @@ #include #endif /* IPSEC */ +#ifdef XCAST6 +#include +#endif + #include +#include "xcst.h" +#if NXCST > 0 +#include +#endif + #include #define offsetof(type, member) ((size_t)(&((type *)0)->member)) @@ -174,6 +184,9 @@ route6_input, 0, 0, 0, 0, 0, 0, 0, 0, +#ifdef XCAST6 + route6_sysctl, +#endif }, { SOCK_RAW, &inet6domain, IPPROTO_FRAGMENT,PR_ATOMIC|PR_ADDR, frag6_input, 0, 0, 0, @@ -233,6 +246,15 @@ rip6_init, 0, 0, 0, }, }; + +#if NXCST > 0 +struct ip6protosw xcst_protosw = +{ SOCK_RAW, &inet6domain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR, + xcst_input, rip6_output, 0, rip6_ctloutput, + rip6_usrreq, + 0, 0, 0, 0, +}; +#endif /*NXCST*/ struct domain inet6domain = { AF_INET6, "internet6", 0, 0, 0, Only in syssrc-021116ts-xcast6/sys/netinet6: in6_proto.c.orig diff -ur syssrc-021116ts/sys/netinet6/ip6_input.c syssrc-021116ts-xcast6/sys/netinet6/ip6_input.c --- syssrc-021116ts/sys/netinet6/ip6_input.c Mon Sep 23 14:51:14 2002 +++ syssrc-021116ts-xcast6/sys/netinet6/ip6_input.c Sat Nov 30 16:28:38 2002 @@ -71,6 +71,7 @@ #include "opt_inet.h" #include "opt_ipsec.h" #include "opt_pfil_hooks.h" +#include "opt_xcast6.h" #include #include @@ -116,6 +117,10 @@ #include +#ifdef XCAST6 +#include +#endif + /* we need it for NLOOP. */ #include "loop.h" #include "faith.h" @@ -447,6 +452,19 @@ struct in6_multi *in6m = 0; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mcast); +#ifdef XCAST6 + + /* + * Simply compare ip6_dst with ALL_XCAST6_ROUTERS. + * It's difficult to implement non-semi-permeable + * Xcast on classical `join' model. + */ + if (xcast6_enable && xcast6_is_addr_xcast6(&ip6->ip6_dst)) { + ours = 1; + deliverifp = m->m_pkthdr.rcvif; + goto hbhcheck; + } +#endif /* * See if we belong to the destination multicast group on the * arrival interface. @@ -648,6 +666,11 @@ */ if (rtalert != ~0 && ip6_forwarding) ours = 1; +#ifdef XCAST6 + /* accept the packet if a Xcast6 hbh option is included. */ + if (xcast6_enable && xcast6_getctl(m) != NULL) + ours = 1; +#endif /* XCAST6 */ } else nxt = ip6->ip6_nxt; @@ -938,6 +961,24 @@ *plenp = jumboplen; break; +#ifdef XCAST6 + case IP6OPT_TYPE_XCAST6: + if (!xcast6_enable) + goto fakeunknown; + + /* XXX may need check for alignment */ + if (hbhlen < XCAST6_HBH_OPTLEN + 2) { + ip6stat.ip6s_toosmall++; + goto bad; + } + + if (xcast6_process_hopopts(m, opt, &optlen) < 0) + goto bad; + + break; +fakeunknown: + ; /*FALLTHRU*/ +#endif /* XCAST6 */ default: /* unknown option */ if (hbhlen < IP6OPT_MINLEN) { ip6stat.ip6s_toosmall++; Only in syssrc-021116ts-xcast6/sys/netinet6: ip6_input.c.orig diff -ur syssrc-021116ts/sys/netinet6/ip6_output.c syssrc-021116ts-xcast6/sys/netinet6/ip6_output.c --- syssrc-021116ts/sys/netinet6/ip6_output.c Sat Nov 2 16:30:58 2002 +++ syssrc-021116ts-xcast6/sys/netinet6/ip6_output.c Sat Nov 30 16:28:38 2002 @@ -71,6 +71,7 @@ #include "opt_inet.h" #include "opt_ipsec.h" #include "opt_pfil_hooks.h" +#include "opt_xcast6.h" #include #include @@ -109,6 +110,10 @@ extern struct pfil_head inet6_pfil_hook; /* XXX */ #endif +#ifdef XCAST6 +#include +#endif + struct ip6_exthdrs { struct mbuf *ip6e_ip6; struct mbuf *ip6e_hbh; @@ -425,6 +430,18 @@ sizeof(struct in6_addr) * (rh0->ip6r0_segleft - 1)); rh0->ip6r0_addr[rh0->ip6r0_segleft - 1] = finaldst; break; +#ifdef XCAST6 + case IPV6_RTHDR_TYPE_XCAST6: + if (!xcast6_enable) { + error = EINVAL; + goto bad; + } + /* + * leave untouched. + * The header is processed in xcst_output later. + */ + break; +#endif default: /* is it possible? */ error = EINVAL; goto bad; @@ -2175,6 +2192,17 @@ if (opt->ip6po_rthdr->ip6r_segleft == 0) return (EINVAL); break; +#ifdef XCAST6 + case IPV6_RTHDR_TYPE_XCAST6: + if (!xcast6_enable) + return(EINVAL); + /* + * Simply "break" here. + * Validation of XCAST6 routing header will be + * done in xcast6_branch(). + */ + break; +#endif default: return (EINVAL); } Only in syssrc-021116ts-xcast6/sys/netinet6: ip6_output.c.orig diff -ur syssrc-021116ts/sys/netinet6/route6.c syssrc-021116ts-xcast6/sys/netinet6/route6.c --- syssrc-021116ts/sys/netinet6/route6.c Wed Sep 11 11:46:47 2002 +++ syssrc-021116ts-xcast6/sys/netinet6/route6.c Sat Nov 30 16:28:38 2002 @@ -33,6 +33,8 @@ #include __KERNEL_RCSID(0, "$NetBSD: route6.c,v 1.11 2002/09/11 02:46:47 itojun Exp $"); +#include "opt_xcast6.h" + #include #include #include @@ -48,6 +50,10 @@ #include +#ifdef XCAST6 +#include +#endif + static int ip6_rthdr0 __P((struct mbuf *, struct ip6_hdr *, struct ip6_rthdr0 *)); @@ -102,6 +108,33 @@ if (ip6_rthdr0(m, ip6, (struct ip6_rthdr0 *)rh)) return (IPPROTO_DONE); break; +#ifdef XCAST6 + case IPV6_RTHDR_TYPE_XCAST6: + if (!xcast6_enable) + goto fakeunknown; + + rhlen = (rh->ip6r_len + 1) << 3; + +#ifndef PULLDOWN_TEST + /* Copied from TYPE_0. See comments on TYPE_0. */ + IP6_EXTHDR_CHECK(m, off, rhlen, IPPROTO_DONE); +#else + /* Copied from TYPE_0. See comments on TYPE_0. */ + IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, rhlen); + if (rh == NULL) { + ip6stat.ip6s_tooshort++; + return IPPROTO_DONE; + } +#endif + if (xcast6_addctl(m) == NULL) { + /* XXX ENOBUFS. which statistics? */ + return IPPROTO_DONE; + } + xcast6_branch(m, (xcast6_rthdr_t *)rh, offp, ip6->ip6_hlim); + return IPPROTO_DONE; +fakeunknown: + ; /*FALLTHRU*/ +#endif /* XCAST6 */ default: /* unknown routing type */ if (rh->ip6r_segleft == 0) { Only in syssrc-021116ts-xcast6/sys/netinet6: route6.c.orig diff -ur syssrc-021116ts/sys/netinet6/udp6_output.c syssrc-021116ts-xcast6/sys/netinet6/udp6_output.c --- syssrc-021116ts/sys/netinet6/udp6_output.c Wed Sep 11 11:46:47 2002 +++ syssrc-021116ts-xcast6/sys/netinet6/udp6_output.c Sat Nov 30 16:28:38 2002 @@ -298,6 +298,13 @@ fport = in6p->in6p_fport; } +#ifdef XCAST6_DESTOPT + if (xcast6_enable) { + if (xcast6_hasdestopt(in6p->in6p_outputopts)) + fport = 0; + } +#endif + if (af == AF_INET) hlen = sizeof(struct ip); Only in syssrc-021116ts-xcast6/sys/netinet6: udp6_output.c.orig Only in syssrc-021116ts-xcast6/sys/netinet6: xcast6.c Only in syssrc-021116ts-xcast6/sys/netinet6: xcast6.c.orig Only in syssrc-021116ts-xcast6/sys/netinet6: xcast6.h Only in syssrc-021116ts-xcast6/sys/netinet6: xcast6.h.orig