diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-11-21 14:09:42 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-11-21 14:09:42 +0000 |
commit | cd96bff0a02708dba82059193626bb2f6c540b83 (patch) | |
tree | 92669780bcd1ca87819f6827f5036446288be27f /sbin | |
parent | bd9ee9386e3b82970f52fecd6e1608d23375f21a (diff) |
Add new option tunneldomain to ifconfig to specify the routing table
to be used for sending out gre/gif encoded packets. OK deraadt@, henning@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ifconfig/ifconfig.8 | 12 | ||||
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 27 |
2 files changed, 35 insertions, 4 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index cd036592ef7..c960ba3ee8d 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ifconfig.8,v 1.186 2009/11/15 21:35:45 jmc Exp $ +.\" $OpenBSD: ifconfig.8,v 1.187 2009/11/21 14:09:40 claudio Exp $ .\" $NetBSD: ifconfig.8,v 1.11 1996/01/04 21:27:29 pk Exp $ .\" $FreeBSD: ifconfig.8,v 1.16 1998/02/01 07:03:29 steve Exp $ .\" @@ -31,7 +31,7 @@ .\" .\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94 .\" -.Dd $Mdocdate: November 15 2009 $ +.Dd $Mdocdate: November 21 2009 $ .Dt IFCONFIG 8 .Os .Sh NAME @@ -1132,6 +1132,7 @@ or use the following for a listing of choices: .Ar tunnel-interface .Op Cm deletetunnel Ar src_address dest_address .Op Cm tunnel Ar src_address dest_address +.Op Cm tunneldomain Ar route-id .Ek .Pp The options are as follows: @@ -1145,6 +1146,13 @@ including Packets routed to this interface will be encapsulated in IPv4 or IPv6, depending on the source and destination address families. Both addresses must be of the same family. +.It Cm tunneldomain Ar route-id +Use specified routing table id to use instead of the default table. +The tunnel does not need to terminate in the same routing domain as the +interface itself. +.Ar route-id +can be set to any valid routing table id, the corresponding routing domain +is derived from this table. .El .\" VLAN .Sh VLAN diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 61f61ab9ce0..7f1fc8a809b 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.220 2009/06/19 14:05:32 henning Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.221 2009/11/21 14:09:41 claudio Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -171,6 +171,7 @@ void setatrange(const char *, int); void setatphase(const char *, int); void settunnel(const char *, const char *); void deletetunnel(const char *, int); +void settunnelinst(const char *, int); #ifdef INET6 void setia6flags(const char *, int); void setia6pltime(const char *, int); @@ -368,6 +369,7 @@ const struct cmd { { "giftunnel", NEXTARG2, 0, NULL, settunnel } , { "tunnel", NEXTARG2, 0, NULL, settunnel } , { "deletetunnel", 0, 0, deletetunnel } , + { "tunneldomain", NEXTARG, 0, settunnelinst } , { "pppoedev", NEXTARG, 0, setpppoe_dev }, { "pppoesvc", NEXTARG, 0, setpppoe_svc }, { "-pppoesvc", 1, 0, setpppoe_svc }, @@ -2601,8 +2603,13 @@ phys_status(int force) pdstaddr, sizeof(pdstaddr), 0, 0, niflag) != 0) strlcpy(pdstaddr, "<error>", sizeof(pdstaddr)); - printf("\tphysical address inet%s %s --> %s\n", ver, + printf("\tphysical address inet%s %s --> %s", ver, psrcaddr, pdstaddr); + + if (ioctl(s, SIOCGLIFPHYRTABLEID, (caddr_t)&ifr) == 0 && + (rdomainid != 0 || ifr.ifr_rdomainid != 0)) + printf(" rdomain %d", ifr.ifr_rdomainid); + printf("\n"); } const int ifm_status_valid_list[] = IFM_STATUS_VALID_LIST; @@ -3013,6 +3020,22 @@ deletetunnel(const char *ignored, int alsoignored) } void +settunnelinst(const char *id, int param) +{ + const char *errmsg = NULL; + int rdomainid; + + rdomainid = strtonum(id, 0, 128, &errmsg); + if (errmsg) + errx(1, "rdomain %s: %s", id, errmsg); + + strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + ifr.ifr_rdomainid = rdomainid; + if (ioctl(s, SIOCSLIFPHYRTABLEID, (caddr_t)&ifr) < 0) + warn("SIOCSLIFPHYRTABLEID"); +} + +void at_status(int force) { struct sockaddr_at *sat, null_sat; |