diff options
author | Peter Hessler <phessler@cvs.openbsd.org> | 2013-10-21 08:42:26 +0000 |
---|---|---|
committer | Peter Hessler <phessler@cvs.openbsd.org> | 2013-10-21 08:42:26 +0000 |
commit | 71f6cd32c67cb5bd9cc54e8a8a308c895a4d7eaf (patch) | |
tree | bbeba40dae6654a6fe9667f44e717a1d2b2b1439 | |
parent | be024735319d88fec36c261f5c812c467eda5dcc (diff) |
Sprinkle a lot more IPv6 routing domains support in the kernel.
Mostly mechanical, setting and passing the rdomain and rtable correctly.
Not yet enabled.
Lots of help and hints from claudio and bluhm
OK claudio@, bluhm@
-rw-r--r-- | sys/netinet/icmp6.h | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 17 | ||||
-rw-r--r-- | sys/netinet/tcp_var.h | 4 | ||||
-rw-r--r-- | sys/netinet6/icmp6.c | 18 | ||||
-rw-r--r-- | sys/netinet6/in6_src.c | 4 |
5 files changed, 23 insertions, 24 deletions
diff --git a/sys/netinet/icmp6.h b/sys/netinet/icmp6.h index 5bd1943fe98..00d6a84078c 100644 --- a/sys/netinet/icmp6.h +++ b/sys/netinet/icmp6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.h,v 1.36 2013/06/01 01:30:53 brad Exp $ */ +/* $OpenBSD: icmp6.h,v 1.37 2013/10/21 08:42:24 phessler Exp $ */ /* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */ /* @@ -702,7 +702,7 @@ int icmp6_sysctl(int *, u_int, void *, size_t *, void *, size_t); struct ip6ctlparam; void icmp6_mtudisc_update(struct ip6ctlparam *, int); -void icmp6_mtudisc_callback_register(void (*)(struct in6_addr *)); +void icmp6_mtudisc_callback_register(void (*)(struct sockaddr_in6 *, u_int)); /* XXX: is this the right place for these macros? */ #define icmp6_ifstat_inc(ifp, tag) \ diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 3bb7f08f688..c2143fb161b 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.122 2013/10/20 11:03:01 phessler Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.123 2013/10/21 08:42:24 phessler Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -891,17 +891,12 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) * Path MTU Discovery handlers. */ void -tcp6_mtudisc_callback(faddr) - struct in6_addr *faddr; +tcp6_mtudisc_callback(sin6, rdomain) + struct sockaddr_in6 *sin6; + u_int rdomain; { - struct sockaddr_in6 sin6; - - bzero(&sin6, sizeof(sin6)); - sin6.sin6_family = AF_INET6; - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_addr = *faddr; - (void) in6_pcbnotify(&tcbtable, &sin6, 0, - &sa6_any, 0, /* XXX rdomain */ 0, PRC_MSGSIZE, NULL, tcp_mtudisc); + (void) in6_pcbnotify(&tcbtable, sin6, 0, + &sa6_any, 0, rdomain, PRC_MSGSIZE, NULL, tcp_mtudisc); } #endif /* INET6 */ diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index acded92556b..1d4885aa86d 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_var.h,v 1.102 2013/08/12 21:57:16 bluhm Exp $ */ +/* $OpenBSD: tcp_var.h,v 1.103 2013/10/21 08:42:24 phessler Exp $ */ /* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */ /* @@ -590,7 +590,7 @@ void tcp_mtudisc(struct inpcb *, int); void tcp_mtudisc_increase(struct inpcb *, int); #ifdef INET6 void tcp6_mtudisc(struct inpcb *, int); -void tcp6_mtudisc_callback(struct in6_addr *); +void tcp6_mtudisc_callback(struct sockaddr_in6 *, u_int); #endif struct tcpcb * tcp_newtcpcb(struct inpcb *); diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index ce399c92a08..03434510f91 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.131 2013/10/17 16:27:45 bluhm Exp $ */ +/* $OpenBSD: icmp6.c,v 1.132 2013/10/21 08:42:25 phessler Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -142,7 +142,7 @@ extern int icmp6_nodeinfo; */ struct icmp6_mtudisc_callback { LIST_ENTRY(icmp6_mtudisc_callback) mc_list; - void (*mc_func)(struct in6_addr *); + void (*mc_func)(struct sockaddr_in6 *, u_int); }; LIST_HEAD(, icmp6_mtudisc_callback) icmp6_mtudisc_callbacks = @@ -248,7 +248,7 @@ icmp6_errcount(struct icmp6errstat *stat, int type, int code) * Register a Path MTU Discovery callback. */ void -icmp6_mtudisc_callback_register(void (*func)(struct in6_addr *)) +icmp6_mtudisc_callback_register(void (*func)(struct sockaddr_in6 *, u_int)) { struct icmp6_mtudisc_callback *mc; @@ -1142,7 +1142,9 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) sin6.sin6_addr.s6_addr16[1] = htons(m->m_pkthdr.rcvif->if_index); } - /* sin6.sin6_scope_id = XXX: should be set if DST is a scoped addr */ + sin6.sin6_scope_id = in6_addr2scopeid(m->m_pkthdr.rcvif, + &sin6.sin6_addr); + rt = icmp6_mtudisc_clone(sin6tosa(&sin6), m->m_pkthdr.rdomain); if (rt && (rt->rt_flags & RTF_HOST) && @@ -1163,7 +1165,7 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) */ for (mc = LIST_FIRST(&icmp6_mtudisc_callbacks); mc != NULL; mc = LIST_NEXT(mc, mc_list)) - (*mc->mc_func)(&sin6.sin6_addr); + (*mc->mc_func)(&sin6, m->m_pkthdr.rdomain); } /* @@ -2349,11 +2351,11 @@ icmp6_redirect_input(struct mbuf *m, int off) bcopy(&src6, &ssrc.sin6_addr, sizeof(struct in6_addr)); rtredirect(sin6tosa(&sdst), sin6tosa(&sgw), NULL, RTF_GATEWAY | RTF_HOST, sin6tosa(&ssrc), - &newrt, /* XXX */ 0); + &newrt, m->m_pkthdr.rdomain); if (newrt) { (void)rt_timer_add(newrt, icmp6_redirect_timeout, - icmp6_redirect_timeout_q, /* XXX */ 0); + icmp6_redirect_timeout_q, m->m_pkthdr.rdomain); rtfree(newrt); } } @@ -2786,7 +2788,7 @@ icmp6_mtudisc_clone(struct sockaddr *dst, u_int rdomain) rt = nrt; } error = rt_timer_add(rt, icmp6_mtudisc_timeout, - icmp6_mtudisc_timeout_q, /* XXX */ 0); + icmp6_mtudisc_timeout_q, rdomain); if (error) { rtfree(rt); return NULL; diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 346eb8819ea..49d334a3d6e 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_src.c,v 1.33 2013/10/17 16:27:46 bluhm Exp $ */ +/* $OpenBSD: in6_src.c,v 1.34 2013/10/21 08:42:25 phessler Exp $ */ /* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */ /* @@ -259,6 +259,7 @@ in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, /* No route yet, so try to acquire one */ bzero(&ro->ro_dst, sizeof(struct sockaddr_in6)); + ro->ro_tableid = rtableid; sa6 = &ro->ro_dst; sa6->sin6_family = AF_INET6; sa6->sin6_len = sizeof(struct sockaddr_in6); @@ -445,6 +446,7 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, /* No route yet, so try to acquire one */ bzero(&ro->ro_dst, sizeof(struct sockaddr_in6)); + ro->ro_tableid = rtableid; sa6 = &ro->ro_dst; *sa6 = *dstsock; sa6->sin6_scope_id = 0; |