diff options
Diffstat (limited to 'sbin/nos-tun')
-rw-r--r-- | sbin/nos-tun/nos-tun.8 | 10 | ||||
-rw-r--r-- | sbin/nos-tun/nos-tun.c | 25 |
2 files changed, 30 insertions, 5 deletions
diff --git a/sbin/nos-tun/nos-tun.8 b/sbin/nos-tun/nos-tun.8 index e77de82..e08b934 100644 --- a/sbin/nos-tun/nos-tun.8 +++ b/sbin/nos-tun/nos-tun.8 @@ -6,7 +6,7 @@ .\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp .\" ---------------------------------------------------------------------------- .\" -.\" $Id: nos-tun.8,v 1.1 1998/04/11 19:33:05 phk Exp $ +.\" $Id: nos-tun.8,v 1.2 1998/05/05 06:24:12 charnier Exp $ .\" .Dd April 11, 1998 .Dt NOS-TUN 8 @@ -22,6 +22,8 @@ .Ar source .Fl d .Ar destination +.Fl p +.Ar protocol_number .Ar target .Sh DESCRIPTION .Nm Nos-tun @@ -51,6 +53,10 @@ in the .Bx Free end, a concept cisco doesn't really implement. .Pp +.Ar Protocol number +sets tunnel mode. Original KA9Q NOS uses 94 but many peoples use 4 +in worldwide backbone of ampr.org. +.Pp .Ar Target is the address of the remote tunnel device, this must match the source address set on the remote end. @@ -77,3 +83,5 @@ We don't allow for setting our source address for multihomed machines. wrote the program, .An Poul-Henning Kamp Aq phk@FreeBSD.org wrote the man-page. +.An Isao SEKI Aq iseki@gongon.com +added a new flag, IP protocol number. diff --git a/sbin/nos-tun/nos-tun.c b/sbin/nos-tun/nos-tun.c index 20058ca..ae8a767 100644 --- a/sbin/nos-tun/nos-tun.c +++ b/sbin/nos-tun/nos-tun.c @@ -48,9 +48,16 @@ * (and why do you want more ?) */ +/* + * Mar. 23 1999 by Isao SEKI <iseki@gongon.com> + * I added a new flag for ip protocol number. + * We are using 4 as protocol number in ampr.org. + * + */ + #ifndef lint static const char rcsid[] = - "$Id: nos-tun.c,v 1.3 1998/07/15 06:38:53 charnier Exp $"; + "$Id: nos-tun.c,v 1.4 1998/08/02 16:06:34 bde Exp $"; #endif /* not lint */ #include <fcntl.h> @@ -232,6 +239,8 @@ int main (int argc, char **argv) char *point_to = NULL; char *to_point = NULL; char *target; + char *protocol = NULL; + int protnum; struct sockaddr t_laddr; /* Source address of tunnel */ struct sockaddr whereto; /* Destination of tunnel */ @@ -244,7 +253,7 @@ int main (int argc, char **argv) int nfds; /* Return from select() */ - while ((c = getopt(argc, argv, "d:s:t:")) != -1) { + while ((c = getopt(argc, argv, "d:s:t:p:")) != -1) { switch (c) { case 'd': to_point = optarg; @@ -255,6 +264,9 @@ int main (int argc, char **argv) case 't': devname = optarg; break; + case 'p': + protocol = optarg; + break; } } argc -= optind; @@ -265,6 +277,11 @@ int main (int argc, char **argv) usage(); } + if(protocol == NULL) + protnum = 94; + else + protnum = atoi(protocol); + target = *argv; /* Establish logging through 'syslog' */ @@ -284,7 +301,7 @@ int main (int argc, char **argv) if(Set_address(target, to)) Finish(4); - if ((net = socket(AF_INET, SOCK_RAW, 94)) < 0) { + if ((net = socket(AF_INET, SOCK_RAW, protnum)) < 0) { syslog(LOG_ERR,"can't open socket - %m"); Finish(5); } @@ -348,7 +365,7 @@ static void usage() { fprintf(stderr, -"usage: nos_tun -t <tun_name> -s <source_addr> -d <dest_addr> <target_addr>\n"); +"usage: nos_tun -t <tun_name> -s <source_addr> -d <dest_addr> -p <protocol_number> <target_addr>\n"); exit(1); } |