summaryrefslogtreecommitdiff
path: root/sys/netinet/in_pcb.c
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2000-09-18 22:06:39 +0000
committerNiels Provos <provos@cvs.openbsd.org>2000-09-18 22:06:39 +0000
commit90175ecf691a7934faa9072f3a1ed18f4e91deb3 (patch)
tree68bd50ddf0e438117ac0a4f0bb898d7075a341c3 /sys/netinet/in_pcb.c
parentc396a799db246d91ccfc784bce1f77a21e417f2a (diff)
Path MTU discovery based on NetBSD but with the decision to use the DF
flag delayed to ip_output(). That halves the code and reduces most of the route lookups. okay deraadt@
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r--sys/netinet/in_pcb.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index faec511620b..f0fc288ca89 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.42 2000/04/27 09:23:21 itojun Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.43 2000/09/18 22:06:37 provos Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -859,6 +859,43 @@ in_pcblookup(table, faddrp, fport_arg, laddrp, lport_arg, flags)
return (match);
}
+struct rtentry *
+in_pcbrtentry(inp)
+ struct inpcb *inp;
+{
+ struct route *ro;
+
+ ro = &inp->inp_route;
+
+ /*
+ * No route yet, so try to acquire one.
+ */
+ if (ro->ro_rt == NULL) {
+ switch(sotopf(inp->inp_socket)) {
+#ifdef INET6
+ case PF_INET6:
+ if (IN6_IS_ADDR_UNSPECIFIED(&inp->inp_faddr6))
+ break;
+ ro->ro_dst.sa_family = AF_INET6;
+ ro->ro_dst.sa_len = sizeof(struct sockaddr_in6);
+ ((struct sockaddr_in6 *) &ro->ro_dst)->sin6_addr =
+ inp->inp_faddr6;
+ rtalloc(ro);
+ break;
+#endif /* INET6 */
+ case PF_INET:
+ if (inp->inp_faddr.s_addr != INADDR_ANY)
+ break;
+ ro->ro_dst.sa_family = AF_INET;
+ ro->ro_dst.sa_len = sizeof(ro->ro_dst);
+ satosin(&ro->ro_dst)->sin_addr = inp->inp_faddr;
+ rtalloc(ro);
+ break;
+ }
+ }
+ return (ro->ro_rt);
+}
+
struct sockaddr_in *
in_selectsrc(sin, ro, soopts, mopts, errorp)
struct sockaddr_in *sin;