diff options
author | charnier <charnier@FreeBSD.org> | 1998-05-05 06:24:15 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1998-05-05 06:24:15 +0000 |
commit | 64b58ad866253e7928ba243ce22e637e2ee73de0 (patch) | |
tree | c8e289ae241e0481a91d752bd6682951a391e361 /sbin | |
parent | 810a5d762ec2f1bdce027ec79177062cfda53f4f (diff) | |
download | FreeBSD-src-64b58ad866253e7928ba243ce22e637e2ee73de0.zip FreeBSD-src-64b58ad866253e7928ba243ce22e637e2ee73de0.tar.gz |
Add usage() and rcsid. Getopt() returns -1 not EOF. Remove unused #includes.
Use .An/.Aq in man page.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/nos-tun/nos-tun.8 | 30 | ||||
-rw-r--r-- | sbin/nos-tun/nos-tun.c | 30 |
2 files changed, 38 insertions, 22 deletions
diff --git a/sbin/nos-tun/nos-tun.8 b/sbin/nos-tun/nos-tun.8 index f3af572..e77de82 100644 --- a/sbin/nos-tun/nos-tun.8 +++ b/sbin/nos-tun/nos-tun.8 @@ -6,14 +6,14 @@ .\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp .\" ---------------------------------------------------------------------------- .\" -.\" $Id$ +.\" $Id: nos-tun.8,v 1.1 1998/04/11 19:33:05 phk Exp $ .\" .Dd April 11, 1998 .Dt NOS-TUN 8 .Os FreeBSD 3.0 .Sh NAME .Nm nos-tun -.Nd Implement ``nos'' or ``ka9q'' style IP over IP tunnel +.Nd implement ``nos'' or ``ka9q'' style IP over IP tunnel .Sh SYNOPSIS .Nm nos-tun .Fl t @@ -24,7 +24,7 @@ .Ar destination .Ar target .Sh DESCRIPTION -.Nm +.Nm Nos-tun is used to establish an .Em nos style tunnel, (also known as @@ -35,25 +35,29 @@ tunnel) using a .Xr tun 4 kernel interface. .Pp -.Ar tunnel +.Ar Tunnel is the name of the tunnel device -.Dq /dev/tun0 +.Pa /dev/tun0 for example. .Pp -.Ar source +.Ar Source and .Ar destination are the addresses used on the tunnel device. If you configure the tunnel against a cisco router, use a netmask of .Dq 255.255.255.252 on the cisco. This is because the tunnel is a point-to-point interface -in the FreeBSD end, a concept cisco doesn't really implement. +in the +.Bx Free +end, a concept cisco doesn't really implement. .Pp -.Ar target +.Ar Target is the address of the remote tunnel device, this must match the source address set on the remote end. .Sh EXAMPLES -This end, a FreeBSD box on address 192.168.59.34: +This end, a +.Bx Free +box on address 192.168.59.34: .Bd -literal -offset indent 4m nos-tun -t /dev/tun0 -s 192.168.61.1 -d 192.168.61.2 192.168.56.45 .Ed @@ -68,6 +72,8 @@ tunnel source 192.168.56.45 .Ed .Sh BUGS We don't allow for setting our source address for multihomed machines. -.Sh AUTHOR -Nickolay N. Dudorov <nnd@itfs.nsk.su> wrote the program, -Poul-Henning Kamp <phk@FreeBSD.org> wrote the man-page. +.Sh AUTHORS +.An Nickolay N. Dudorov Aq nnd@itfs.nsk.su +wrote the program, +.An Poul-Henning Kamp Aq phk@FreeBSD.org +wrote the man-page. diff --git a/sbin/nos-tun/nos-tun.c b/sbin/nos-tun/nos-tun.c index 7847d5e..35266ea 100644 --- a/sbin/nos-tun/nos-tun.c +++ b/sbin/nos-tun/nos-tun.c @@ -49,24 +49,26 @@ */ +#include <fcntl.h> +#include <netdb.h> #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #include <string.h> -#include <fcntl.h> -#include <netdb.h> #include <syslog.h> -#include <sys/param.h> +#include <sys/signal.h> #include <sys/socket.h> #include <sys/ioctl.h> -#include <sys/signal.h> -#include <sys/time.h> #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/ip.h> #include <net/if.h> #include <arpa/inet.h> +#include <unistd.h> +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ /* Tunnel interface configuration stuff */ static struct ifaliasreq ifra; @@ -76,6 +78,8 @@ static struct ifreq ifrq; int net; /* socket descriptor */ int tun; /* tunnel descriptor */ +static void usage __P((void)); + int Set_address(char *addr, struct sockaddr_in *sin) { struct hostent *hp; @@ -241,7 +245,7 @@ int main (int argc, char **argv) int nfds; /* Return from select() */ - while ((c = getopt(argc, argv, "d:s:t:")) != EOF) { + while ((c = getopt(argc, argv, "d:s:t:")) != -1) { switch (c) { case 'd': to_point = optarg; @@ -259,9 +263,7 @@ int main (int argc, char **argv) if (argc != 1 || (devname == NULL) || (point_to == NULL) || (to_point == NULL)) { - fprintf(stderr, - "Usage: nos_tun -t <tun_name> -s <source_addr> -d <dest_addr> <target_addr>\n"); - exit(1); + usage(); } target = *argv; @@ -343,3 +345,11 @@ int main (int argc, char **argv) } } +static void +usage() +{ + fprintf(stderr, +"usage: nos_tun -t <tun_name> -s <source_addr> -d <dest_addr> <target_addr>\n"); + exit(1); +} + |