summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/in_pcb.c81
-rw-r--r--sys/netinet/ip_icmp.c28
-rw-r--r--sys/netinet6/in6_pcb.c50
-rw-r--r--sys/netinet6/ip6_input.c13
-rw-r--r--sys/netinet6/ip6_output.c84
5 files changed, 9 insertions, 247 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 1f25c3545fc..351a0c2ab0f 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.58 2001/12/06 02:21:48 itojun Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.59 2002/01/21 05:33:14 itojun Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -403,84 +403,6 @@ in_pcbconnect(v, nam)
sin->sin_addr = in_ifaddr.tqh_first->ia_broadaddr.sin_addr;
}
if (inp->inp_laddr.s_addr == INADDR_ANY) {
-#if 0
- register struct route *ro;
- struct sockaddr_in *sin2;
- struct in_ifaddr *ia;
-
- ia = (struct in_ifaddr *)0;
- /*
- * If route is known or can be allocated now,
- * our src addr is taken from the i/f, else punt.
- */
- ro = &inp->inp_route;
- if (ro->ro_rt &&
- (satosin(&ro->ro_dst)->sin_addr.s_addr !=
- sin->sin_addr.s_addr ||
- inp->inp_socket->so_options & SO_DONTROUTE)) {
- RTFREE(ro->ro_rt);
- ro->ro_rt = (struct rtentry *)0;
- }
- if ((inp->inp_socket->so_options & SO_DONTROUTE) == 0 && /*XXX*/
- (ro->ro_rt == (struct rtentry *)0 ||
- ro->ro_rt->rt_ifp == (struct ifnet *)0)) {
- /* No route yet, so try to acquire one */
- ro->ro_dst.sa_family = AF_INET;
- ro->ro_dst.sa_len = sizeof(struct sockaddr_in);
- satosin(&ro->ro_dst)->sin_addr = sin->sin_addr;
- rtalloc(ro);
-
- /*
- * It is important to bzero out the rest of the
- * struct sockaddr_in when mixing v6 & v4!
- */
- sin2 = (struct sockaddr_in *)&ro->ro_dst;
- bzero(sin2->sin_zero, sizeof(sin2->sin_zero));
- }
- /*
- * If we found a route, use the address
- * corresponding to the outgoing interface
- * unless it is the loopback (in case a route
- * to our address on another net goes to loopback).
- */
- if (ro->ro_rt && !(ro->ro_rt->rt_ifp->if_flags & IFF_LOOPBACK))
- ia = ifatoia(ro->ro_rt->rt_ifa);
- if (ia == 0) {
- u_int16_t fport = sin->sin_port;
-
- sin->sin_port = 0;
- ia = ifatoia(ifa_ifwithdstaddr(sintosa(sin)));
- if (ia == 0)
- ia = ifatoia(ifa_ifwithnet(sintosa(sin)));
- sin->sin_port = fport;
- if (ia == 0)
- ia = in_ifaddr.tqh_first;
- if (ia == 0)
- return (EADDRNOTAVAIL);
- }
- /*
- * If the destination address is multicast and an outgoing
- * interface has been set as a multicast option, use the
- * address of that interface as our source address.
- */
- if (IN_MULTICAST(sin->sin_addr.s_addr) &&
- inp->inp_moptions != NULL) {
- struct ip_moptions *imo;
- struct ifnet *ifp;
-
- imo = inp->inp_moptions;
- if (imo->imo_multicast_ifp != NULL) {
- ifp = imo->imo_multicast_ifp;
- for (ia = in_ifaddr.tqh_first; ia != 0;
- ia = ia->ia_list.tqe_next)
- if (ia->ia_ifp == ifp)
- break;
- if (ia == 0)
- return (EADDRNOTAVAIL);
- }
- }
- ifaddr = satosin(&ia->ia_addr);
-#else
int error;
ifaddr = in_selectsrc(sin, &inp->inp_route,
inp->inp_socket->so_options, inp->inp_moptions, &error);
@@ -489,7 +411,6 @@ in_pcbconnect(v, nam)
error = EADDRNOTAVAIL;
return error;
}
-#endif
}
if (in_pcbhashlookup(inp->inp_table, sin->sin_addr, sin->sin_port,
inp->inp_laddr.s_addr ? inp->inp_laddr : ifaddr->sin_addr,
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index baecfbc642c..216a275a154 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.44 2002/01/12 00:51:59 ericj Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.45 2002/01/21 05:33:14 itojun Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -368,32 +368,6 @@ icmp_input(m, va_alist)
break;
case ICMP_UNREACH_NEEDFRAG:
-#if 0 /*NRL INET6*/
- if (icp->icmp_nextmtu) {
- extern int ipv6_trans_mtu
- __P((struct mbuf **, int, int));
- struct mbuf *m0 = m;
-
- /*
- * Do cool v4-related path MTU, for now,
- * only v6-in-v4 can handle it.
- */
- if (icmplen >= ICMP_V6ADVLENMIN &&
- icmplen >= ICMP_V6ADVLEN(icp) &&
- icp->icmp_ip.ip_p == IPPROTO_IPV6) {
- /*
- * ipv6_trans_mtu returns 1 if
- * the mbuf is still intact.
- */
- if (ipv6_trans_mtu(&m0,icp->icmp_nextmtu,
- hlen + ICMP_V6ADVLEN(icp))) {
- m = m0;
- goto raw;
- } else
- return;
- }
- }
-#endif /* INET6 */
code = PRC_MSGSIZE;
break;
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 47074f216da..7cfbd556cfe 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_pcb.c,v 1.26 2001/06/05 02:31:37 deraadt Exp $ */
+/* $OpenBSD: in6_pcb.c,v 1.27 2002/01/21 05:33:14 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -257,36 +257,8 @@ in6_pcbbind(inp, nam)
(IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|IN6_IFF_DETACHED))
return(EADDRNOTAVAIL);
}
-#if 0 /* we don't support it */
- else if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
- struct sockaddr_in sin;
-
- bzero(&sin, sizeof(sin));
- sin.sin_port = 0;
- sin.sin_len = sizeof(sin);
- sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = sin6->sin6_addr.s6_addr32[3];
-
- /*
- * Yechhhh, because of upcoming call to
- * ifa_ifwithaddr(), which does bcmp's
- * over the PORTS as well. (What about flow?)
- */
- sin6->sin6_port = 0;
- sin6->sin6_flowinfo = 0;
- if (ifa_ifwithaddr((struct sockaddr *)sin6) == 0) {
- if (!IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr) ||
- ifa_ifwithaddr((struct sockaddr *)&sin) == 0) {
- return EADDRNOTAVAIL;
- }
- }
- }
-#endif
if (lport) {
struct inpcb *t;
-#if 0 /* we don't support IPv4 mapped address */
- struct in_addr fa,la;
-#endif
/*
* Question: Do we wish to continue the Berkeley
@@ -301,22 +273,10 @@ in6_pcbbind(inp, nam)
(error = suser(p->p_ucred, &p->p_acflag)))
return error;
-#if 0 /* we don't support IPv4 mapped address */
- if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
- fa.s_addr = 0;
- la.s_addr = sin6->sin6_addr.s6_addr32[3];
- wild &= ~INPLOOKUP_IPV6;
-
- t = in_pcblookup(head, (struct in_addr *)&fa, 0,
- (struct in_addr *)&la, lport, wild);
- } else
-#endif
- {
- t = in_pcblookup(head,
- (struct in_addr *)&zeroin6_addr, 0,
- (struct in_addr *)&sin6->sin6_addr, lport,
- wild);
- }
+ t = in_pcblookup(head,
+ (struct in_addr *)&zeroin6_addr, 0,
+ (struct in_addr *)&sin6->sin6_addr, lport,
+ wild);
if (t && (reuseport & t->inp_socket->so_options) == 0)
return EADDRINUSE;
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 801aaeba162..19f14b53fc5 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.39 2002/01/02 22:47:47 deraadt Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.40 2002/01/21 05:33:14 itojun Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -220,17 +220,6 @@ ip6_input(m)
int nxt, ours = 0;
struct ifnet *deliverifp = NULL;
-#if 0 /* IPSEC */
- /*
- * should the inner packet be considered authentic?
- * see comment in ah4_input().
- */
- if (m) {
- m->m_flags &= ~M_AUTHIPHDR;
- m->m_flags &= ~M_AUTHIPDGM;
- }
-#endif
-
/*
* mbuf statistics by kazu
*/
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index a09717733af..d2c720a80a6 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_output.c,v 1.56 2001/12/07 09:16:07 itojun Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.57 2002/01/21 05:33:14 itojun Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -398,61 +398,6 @@ ip6_output(m0, opt, ro, flags, im6o, ifpp)
nexthdrp, IPPROTO_DSTOPTS);
MAKE_CHAIN(exthdrs.ip6e_rthdr, mprev,
nexthdrp, IPPROTO_ROUTING);
-
-#if 0 /*KAME IPSEC*/
- if (!needipsec)
- goto skip_ipsec2;
-
- /*
- * pointers after IPsec headers are not valid any more.
- * other pointers need a great care too.
- * (IPsec routines should not mangle mbufs prior to AH/ESP)
- */
- exthdrs.ip6e_dest2 = NULL;
-
- {
- struct ip6_rthdr *rh = NULL;
- int segleft_org = 0;
- struct ipsec_output_state state;
-
- if (exthdrs.ip6e_rthdr) {
- rh = mtod(exthdrs.ip6e_rthdr, struct ip6_rthdr *);
- segleft_org = rh->ip6r_segleft;
- rh->ip6r_segleft = 0;
- }
-
- bzero(&state, sizeof(state));
- state.m = m;
- error = ipsec6_output_trans(&state, nexthdrp, mprev, sp, flags,
- &needipsectun);
- m = state.m;
- if (error) {
- /* mbuf is already reclaimed in ipsec6_output_trans. */
- m = NULL;
- switch (error) {
- case EHOSTUNREACH:
- case ENETUNREACH:
- case EMSGSIZE:
- case ENOBUFS:
- case ENOMEM:
- break;
- default:
- printf("ip6_output (ipsec): error code %d\n", error);
- /*fall through*/
- case ENOENT:
- /* don't show these error codes to the user */
- error = 0;
- break;
- }
- goto bad;
- }
- if (exthdrs.ip6e_rthdr) {
- /* ah6_output doesn't modify mbuf chain */
- rh->ip6r_segleft = segleft_org;
- }
- }
-skip_ipsec2:;
-#endif
}
/*
@@ -1381,18 +1326,6 @@ ip6_ctloutput(op, so, level, optname, mp)
# undef in6p_flags
break;
-#if 0 /*KAME IPSEC*/
- case IPV6_IPSEC_POLICY:
- {
- caddr_t req = NULL;
- if (m != 0)
- req = mtod(m, caddr_t);
- error = ipsec6_set_policy(in6p, optname, req,
- privileged);
- }
- break;
-#endif /* IPSEC */
-
case IPSEC6_OUTSA:
#ifndef IPSEC
error = EINVAL;
@@ -1605,21 +1538,6 @@ ip6_ctloutput(op, so, level, optname, mp)
error = ip6_getmoptions(optname, inp->inp_moptions6, mp);
break;
-#if 0 /*KAME IPSEC*/
- case IPV6_IPSEC_POLICY:
- {
- caddr_t req = NULL;
- int len = 0;
-
- if (m != 0) {
- req = mtod(m, caddr_t);
- len = m->m_len;
- }
- error = ipsec6_get_policy(in6p, req, mp);
- break;
- }
-#endif /* IPSEC */
-
case IPSEC6_OUTSA:
#ifndef IPSEC
error = EINVAL;