summaryrefslogtreecommitdiff
path: root/sbin/route
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2005-05-27 04:55:29 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2005-05-27 04:55:29 +0000
commit4470f6d571b57a867ad4f7875ea2cd7f46612f98 (patch)
tree8400c69016747dd92adad4694f3ecc9963d6d1f1 /sbin/route
parente0dcbdc8ae74cec294cbf562a7cb834495055882 (diff)
Experimental support for opportunitic use of jumbograms where only some hosts
on the local network support them. This adds a new socket option, SO_JUMBO, and a new route flag, RTF_JUMBO. If _both_ the socket option is set and the route for the host has RTF_JUMBO set, ip_output will fragment the packet to the largest possible size for the link, ignoring the card's MTU. The semantics of this feature will be evolving rapidly; talk to us if you intend to use it. ok deraadt@ marius@
Diffstat (limited to 'sbin/route')
-rw-r--r--sbin/route/keywords.h10
-rw-r--r--sbin/route/keywords.sh4
-rw-r--r--sbin/route/route.c19
-rw-r--r--sbin/route/show.c3
4 files changed, 26 insertions, 10 deletions
diff --git a/sbin/route/keywords.h b/sbin/route/keywords.h
index 5f065485cba..3c80f2693f8 100644
--- a/sbin/route/keywords.h
+++ b/sbin/route/keywords.h
@@ -1,10 +1,10 @@
-/* $OpenBSD: keywords.h,v 1.17 2005/03/30 08:04:16 henning Exp $ */
+/* $OpenBSD: keywords.h,v 1.18 2005/05/27 04:55:27 mcbride Exp $ */
/* WARNING! This file was generated by keywords.sh */
struct keytab {
- char *kt_cp;
- int kt_i;
+ char *kt_cp;
+ int kt_i;
};
enum {
@@ -29,6 +29,7 @@ enum {
K_INET,
K_INET6,
K_IPX,
+ K_JUMBO,
K_LABEL,
K_LINK,
K_LLINFO,
@@ -39,6 +40,7 @@ enum {
K_MTU,
K_NET,
K_NETMASK,
+ K_NOJUMBO,
K_NOSTATIC,
K_PREFIXLEN,
K_PROTO1,
@@ -76,6 +78,7 @@ struct keytab keywords[] = {
{ "inet", K_INET },
{ "inet6", K_INET6 },
{ "ipx", K_IPX },
+ { "jumbo", K_JUMBO },
{ "label", K_LABEL },
{ "link", K_LINK },
{ "llinfo", K_LLINFO },
@@ -86,6 +89,7 @@ struct keytab keywords[] = {
{ "mtu", K_MTU },
{ "net", K_NET },
{ "netmask", K_NETMASK },
+ { "nojumbo", K_NOJUMBO },
{ "nostatic", K_NOSTATIC },
{ "prefixlen", K_PREFIXLEN },
{ "proto1", K_PROTO1 },
diff --git a/sbin/route/keywords.sh b/sbin/route/keywords.sh
index 348940ee660..e0544f9ce55 100644
--- a/sbin/route/keywords.sh
+++ b/sbin/route/keywords.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: keywords.sh,v 1.16 2005/03/30 08:02:34 deraadt Exp $
+# $OpenBSD: keywords.sh,v 1.17 2005/05/27 04:55:27 mcbride Exp $
# $NetBSD: keywords.sh,v 1.2 1996/11/15 18:57:21 gwr Exp $
# @(#)keywords 8.2 (Berkeley) 3/19/94
#
@@ -29,6 +29,7 @@ ifp
inet
inet6
ipx
+jumbo
label
link
llinfo
@@ -39,6 +40,7 @@ mpath
mtu
net
netmask
+nojumbo
nostatic
prefixlen
proto1
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 8eb3c9b9116..e190f028a77 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.87 2005/03/30 07:59:03 henning Exp $ */
+/* $OpenBSD: route.c,v 1.88 2005/05/27 04:55:27 mcbride Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -96,7 +96,7 @@ void bprintf(FILE *, int, char *);
void mask_addr(union sockunion *, union sockunion *, int);
int inet6_makenetandmask(struct sockaddr_in6 *);
int getaddr(int, char *, struct hostent **);
-int rtmsg(int, int);
+int rtmsg(int, int, int);
__dead void usage(char *);
void set_metric(char *, int);
void inet_makenetandmask(u_int32_t, struct sockaddr_in *, int);
@@ -348,7 +348,7 @@ int
newroute(int argc, char **argv)
{
char *cmd, *dest = "", *gateway = "", *error;
- int ishost = 0, ret = 0, attempts, oerrno, flags = RTF_STATIC;
+ int ishost = 0, ret = 0, attempts, oerrno, flags = RTF_STATIC, use = 0;
int key;
struct hostent *hp = NULL;
@@ -468,6 +468,14 @@ newroute(int argc, char **argv)
case K_MPATH:
flags |= RTF_MPATH;
break;
+ case K_JUMBO:
+ flags |= RTF_JUMBO;
+ use |= RTF_JUMBO;
+ break;
+ case K_NOJUMBO:
+ flags &= ~RTF_JUMBO;
+ use |= RTF_JUMBO;
+ break;
case K_MTU:
case K_HOPCOUNT:
case K_EXPIRE:
@@ -528,7 +536,7 @@ newroute(int argc, char **argv)
flags |= RTF_GATEWAY;
for (attempts = 1; ; attempts++) {
errno = 0;
- if ((ret = rtmsg(*cmd, flags)) == 0)
+ if ((ret = rtmsg(*cmd, flags, use)) == 0)
break;
if (errno != ENETUNREACH && errno != ESRCH)
break;
@@ -938,7 +946,7 @@ struct {
} m_rtmsg;
int
-rtmsg(int cmd, int flags)
+rtmsg(int cmd, int flags, int use)
{
static int seq;
char *cp = m_rtmsg.m_space;
@@ -971,6 +979,7 @@ rtmsg(int cmd, int flags)
#define rtm m_rtmsg.m_rtm
rtm.rtm_type = cmd;
rtm.rtm_flags = flags;
+ rtm.rtm_use = use;
rtm.rtm_version = RTM_VERSION;
rtm.rtm_seq = ++seq;
rtm.rtm_addrs = rtm_addrs;
diff --git a/sbin/route/show.c b/sbin/route/show.c
index d82943384aa..a215921b540 100644
--- a/sbin/route/show.c
+++ b/sbin/route/show.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: show.c,v 1.42 2005/03/30 05:40:55 henning Exp $ */
+/* $OpenBSD: show.c,v 1.43 2005/05/27 04:55:27 mcbride Exp $ */
/* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */
/*
@@ -93,6 +93,7 @@ static const struct bits bits[] = {
{ RTF_PROTO2, '2' },
{ RTF_PROTO3, '3' },
{ RTF_CLONED, 'c' },
+ { RTF_JUMBO, 'J' },
{ 0 }
};