summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2015-09-10 17:52:06 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2015-09-10 17:52:06 +0000
commit950254d909152efb61b61dec32ad79a3f0d2e200 (patch)
treec80bc28d1c1f2e99cca53d1b7c864a44c849e6cc
parentebc7ce9e5c64c6d8611ada6e67026a561d0b15f0 (diff)
It is time to put inet6 on a diet. Use the flensing knife and cut out
the 3rd argument of in6_recoverscope() and make it return void. OK dlg@ mikeb@
-rw-r--r--sys/net/pipex.c6
-rw-r--r--sys/netinet/ip_spd.c6
-rw-r--r--sys/netinet/ipsec_input.c6
-rw-r--r--sys/netinet/udp_usrreq.c4
-rw-r--r--sys/netinet6/icmp6.c8
-rw-r--r--sys/netinet6/in6.h5
-rw-r--r--sys/netinet6/in6_pcb.c6
-rw-r--r--sys/netinet6/in6_src.c14
-rw-r--r--sys/netinet6/nd6.c16
-rw-r--r--sys/netinet6/raw_ip6.c4
10 files changed, 30 insertions, 45 deletions
diff --git a/sys/net/pipex.c b/sys/net/pipex.c
index 6df81e9033e..385d4f86ec5 100644
--- a/sys/net/pipex.c
+++ b/sys/net/pipex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.c,v 1.75 2015/09/04 08:43:39 mpi Exp $ */
+/* $OpenBSD: pipex.c,v 1.76 2015/09/10 17:52:05 claudio Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -1754,7 +1754,7 @@ pipex_pptp_userland_lookup_session_ipv6(struct mbuf *m0, struct in6_addr dst)
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_len = sizeof(sin6);
sin6.sin6_family = AF_INET6;
- in6_recoverscope(&sin6, &dst, NULL);
+ in6_recoverscope(&sin6, &dst);
return pipex_pptp_userland_lookup_session(m0, sin6tosa(&sin6));
}
@@ -2190,7 +2190,7 @@ pipex_l2tp_userland_lookup_session_ipv6(struct mbuf *m0, struct in6_addr dst)
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_len = sizeof(sin6);
sin6.sin6_family = AF_INET6;
- in6_recoverscope(&sin6, &dst, NULL);
+ in6_recoverscope(&sin6, &dst);
return pipex_l2tp_userland_lookup_session(m0, sin6tosa(&sin6));
}
diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c
index 4bb02782ac1..39226c874d6 100644
--- a/sys/netinet/ip_spd.c
+++ b/sys/netinet/ip_spd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_spd.c,v 1.86 2015/07/17 18:31:08 blambert Exp $ */
+/* $OpenBSD: ip_spd.c,v 1.87 2015/09/10 17:52:05 claudio Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -241,8 +241,8 @@ ipsp_spd_lookup(struct mbuf *m, int af, int hlen, int *error, int direction,
sdst.sin6.sin6_family = ssrc.sin6.sin6_family = AF_INET6;
sdst.sin6.sin6_len = ssrc.sin6.sin6_len =
sizeof(struct sockaddr_in6);
- in6_recoverscope(&ssrc.sin6, &ddst->sen_ip6_src, NULL);
- in6_recoverscope(&sdst.sin6, &ddst->sen_ip6_dst, NULL);
+ in6_recoverscope(&ssrc.sin6, &ddst->sen_ip6_src);
+ in6_recoverscope(&sdst.sin6, &ddst->sen_ip6_dst);
/*
* If TCP/UDP, extract the port numbers to use in the lookup.
diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c
index fd24da23c77..fe0ee48a6ad 100644
--- a/sys/netinet/ipsec_input.c
+++ b/sys/netinet/ipsec_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsec_input.c,v 1.134 2015/09/09 12:50:08 mpi Exp $ */
+/* $OpenBSD: ipsec_input.c,v 1.135 2015/09/10 17:52:05 claudio Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -213,8 +213,8 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto,
m_copydata(m, offsetof(struct ip6_hdr, ip6_dst),
sizeof(struct in6_addr),
(caddr_t) &(dst_address.sin6.sin6_addr));
- in6_recoverscope(&dst_address.sin6, &dst_address.sin6.sin6_addr,
- NULL);
+ in6_recoverscope(&dst_address.sin6,
+ &dst_address.sin6.sin6_addr);
break;
#endif /* INET6 */
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index be46a48c674..d92b1055701 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.205 2015/08/14 18:07:28 bluhm Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.206 2015/09/10 17:52:05 claudio Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -364,7 +364,7 @@ udp_input(struct mbuf *m, ...)
srcsa.sin6.sin6_flowinfo = htonl(0x0fffffff) & ip6->ip6_flow;
#endif
/* KAME hack: recover scopeid */
- (void)in6_recoverscope(&srcsa.sin6, &ip6->ip6_src, NULL);
+ in6_recoverscope(&srcsa.sin6, &ip6->ip6_src);
break;
#endif /* INET6 */
}
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index ed9775b1b64..f9fbdd4843e 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.164 2015/09/09 15:51:40 mpi Exp $ */
+/* $OpenBSD: icmp6.c,v 1.165 2015/09/10 17:52:05 claudio Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -1061,7 +1061,7 @@ icmp6_rip6_input(struct mbuf **mp, int off)
rip6src.sin6_len = sizeof(struct sockaddr_in6);
rip6src.sin6_family = AF_INET6;
/* KAME hack: recover scopeid */
- (void)in6_recoverscope(&rip6src, &ip6->ip6_src, NULL);
+ in6_recoverscope(&rip6src, &ip6->ip6_src);
TAILQ_FOREACH(in6p, &rawin6pcbtable.inpt_queue, inp_queue) {
if (!(in6p->inp_flags & INP_IPV6))
@@ -1216,13 +1216,13 @@ icmp6_reflect(struct mbuf *m, size_t off)
sa6_src.sin6_family = AF_INET6;
sa6_src.sin6_len = sizeof(sa6_src);
sa6_src.sin6_addr = ip6->ip6_dst;
- in6_recoverscope(&sa6_src, &ip6->ip6_dst, if_get(m->m_pkthdr.ph_ifidx));
+ in6_recoverscope(&sa6_src, &ip6->ip6_dst);
in6_embedscope(&ip6->ip6_dst, &sa6_src, NULL, NULL);
bzero(&sa6_dst, sizeof(sa6_dst));
sa6_dst.sin6_family = AF_INET6;
sa6_dst.sin6_len = sizeof(sa6_dst);
sa6_dst.sin6_addr = t;
- in6_recoverscope(&sa6_dst, &t, if_get(m->m_pkthdr.ph_ifidx));
+ in6_recoverscope(&sa6_dst, &t);
in6_embedscope(&t, &sa6_dst, NULL, NULL);
/*
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h
index 0817e4c1106..73be3994fda 100644
--- a/sys/netinet6/in6.h
+++ b/sys/netinet6/in6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.h,v 1.83 2015/06/08 22:19:28 krw Exp $ */
+/* $OpenBSD: in6.h,v 1.84 2015/09/10 17:52:05 claudio Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
@@ -437,8 +437,7 @@ struct inpcb;
int in6_embedscope(struct in6_addr *, const struct sockaddr_in6 *,
struct inpcb *, struct ifnet **);
-int in6_recoverscope(struct sockaddr_in6 *, const struct in6_addr *,
- struct ifnet *);
+void in6_recoverscope(struct sockaddr_in6 *, const struct in6_addr *);
void in6_clearscope(struct in6_addr *);
struct sockaddr;
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 8f47205ec36..cb8acc98634 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_pcb.c,v 1.70 2015/08/22 20:18:50 deraadt Exp $ */
+/* $OpenBSD: in6_pcb.c,v 1.71 2015/09/10 17:52:05 claudio Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -621,7 +621,7 @@ in6_setsockaddr(struct inpcb *inp, struct mbuf *nam)
sin6->sin6_port = inp->inp_lport;
sin6->sin6_addr = inp->inp_laddr6;
/* KAME hack: recover scopeid */
- (void)in6_recoverscope(sin6, &inp->inp_laddr6, NULL);
+ in6_recoverscope(sin6, &inp->inp_laddr6);
return 0;
}
@@ -644,7 +644,7 @@ in6_setpeeraddr(struct inpcb *inp, struct mbuf *nam)
sin6->sin6_port = inp->inp_fport;
sin6->sin6_addr = inp->inp_faddr6;
/* KAME hack: recover scopeid */
- (void)in6_recoverscope(sin6, &inp->inp_faddr6, NULL);
+ in6_recoverscope(sin6, &inp->inp_faddr6);
return 0;
}
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index 5383d9227d4..d040eeb32db 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_src.c,v 1.55 2015/09/03 14:59:23 mpi Exp $ */
+/* $OpenBSD: in6_src.c,v 1.56 2015/09/10 17:52:05 claudio Exp $ */
/* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */
/*
@@ -641,9 +641,8 @@ in6_embedscope(struct in6_addr *in6, const struct sockaddr_in6 *sin6,
* this function should be nuked in the future, when we get rid of
* embedded scopeid thing.
*/
-int
-in6_recoverscope(struct sockaddr_in6 *sin6, const struct in6_addr *in6,
- struct ifnet *ifp)
+void
+in6_recoverscope(struct sockaddr_in6 *sin6, const struct in6_addr *in6)
{
u_int32_t scopeid;
@@ -661,17 +660,10 @@ in6_recoverscope(struct sockaddr_in6 *sin6, const struct in6_addr *in6,
*/
scopeid = ntohs(sin6->sin6_addr.s6_addr16[1]);
if (scopeid) {
- /* sanity check */
- if (if_get(scopeid) == NULL)
- return ENXIO;
- if (ifp && ifp->if_index != scopeid)
- return ENXIO;
sin6->sin6_addr.s6_addr16[1] = 0;
sin6->sin6_scope_id = scopeid;
}
}
-
- return 0;
}
/*
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 4cbdfe7e688..ba57ab46438 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.149 2015/08/31 10:03:47 mpi Exp $ */
+/* $OpenBSD: nd6.c,v 1.150 2015/09/10 17:52:05 claudio Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -1850,7 +1850,7 @@ fill_drlist(void *oldp, size_t *oldlenp, size_t ol)
bzero(d, sizeof(*d));
d->rtaddr.sin6_family = AF_INET6;
d->rtaddr.sin6_len = sizeof(struct sockaddr_in6);
- in6_recoverscope(&d->rtaddr, &dr->rtaddr, dr->ifp);
+ in6_recoverscope(&d->rtaddr, &dr->rtaddr);
d->flags = dr->flags;
d->rtlifetime = dr->rtlifetime;
d->expire = dr->expire;
@@ -1896,19 +1896,14 @@ fill_prlist(void *oldp, size_t *oldlenp, size_t ol)
struct sockaddr_in6 sin6;
struct nd_pfxrouter *pfr;
struct in6_prefix pfx;
- char addr[INET6_ADDRSTRLEN];
if (oldp && p + sizeof(struct in6_prefix) <= pe) {
memset(&pfx, 0, sizeof(pfx));
ps = p;
pfx.prefix = pr->ndpr_prefix;
- if (in6_recoverscope(&pfx.prefix,
- &pfx.prefix.sin6_addr, pr->ndpr_ifp) != 0)
- log(LOG_ERR,
- "scope error in prefix list (%s)\n",
- inet_ntop(AF_INET6, &pfx.prefix.sin6_addr,
- addr, sizeof(addr)));
+ in6_recoverscope(&pfx.prefix,
+ &pfx.prefix.sin6_addr);
pfx.raflags = pr->ndpr_raf;
pfx.prefixlen = pr->ndpr_plen;
pfx.vltime = pr->ndpr_vltime;
@@ -1944,8 +1939,7 @@ fill_prlist(void *oldp, size_t *oldlenp, size_t ol)
bzero(&sin6, sizeof(sin6));
sin6.sin6_family = AF_INET6;
sin6.sin6_len = sizeof(struct sockaddr_in6);
- in6_recoverscope(&sin6, &pfr->router->rtaddr,
- pfr->router->ifp);
+ in6_recoverscope(&sin6, &pfr->router->rtaddr);
advrtrs++;
memcpy(p, &sin6, sizeof(sin6));
p += sizeof(sin6);
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index 61a7804d72f..f27ae94e8b9 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip6.c,v 1.81 2015/09/09 15:51:40 mpi Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.82 2015/09/10 17:52:05 claudio Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@@ -145,7 +145,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
rip6src.sin6_len = sizeof(struct sockaddr_in6);
rip6src.sin6_family = AF_INET6;
/* KAME hack: recover scopeid */
- (void)in6_recoverscope(&rip6src, &ip6->ip6_src, NULL);
+ in6_recoverscope(&rip6src, &ip6->ip6_src);
TAILQ_FOREACH(in6p, &rawin6pcbtable.inpt_queue, inp_queue) {
if (in6p->inp_socket->so_state & SS_CANTRCVMORE)