diff options
author | guenther <> | 2010-07-03 04:44:51 +0000 |
---|---|---|
committer | guenther <> | 2010-07-03 04:44:51 +0000 |
commit | 20222bb70ec0922a2c5c86ccf6e1e905366afc66 (patch) | |
tree | 940c053dfe4d4af830aa7eb97db4e14e914eb4d5 | |
parent | b179d7e13dbf37510aaac7c33b6fa9cc4ac756aa (diff) | |
download | openbsd-20222bb70ec0922a2c5c86ccf6e1e905366afc66.tar.gz openbsd-20222bb70ec0922a2c5c86ccf6e1e905366afc66.tar.bz2 openbsd-20222bb70ec0922a2c5c86ccf6e1e905366afc66.zip |
Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains. This changes the name of the
system calls, socket option, and ioctl. After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.
Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.
Written by claudio@, criticized^Wcritiqued by me
-rw-r--r-- | src/usr.bin/nc/nc.1 | 10 | ||||
-rw-r--r-- | src/usr.bin/nc/netcat.c | 28 |
2 files changed, 19 insertions, 19 deletions
diff --git a/src/usr.bin/nc/nc.1 b/src/usr.bin/nc/nc.1 index 94a2d43cdb..fa0f76b954 100644 --- a/src/usr.bin/nc/nc.1 +++ b/src/usr.bin/nc/nc.1 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: nc.1,v 1.53 2010/02/23 23:00:52 schwarze Exp $ | 1 | .\" $OpenBSD: nc.1,v 1.54 2010/07/03 04:44:51 guenther Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1996 David Sacerdote | 3 | .\" Copyright (c) 1996 David Sacerdote |
4 | .\" All rights reserved. | 4 | .\" All rights reserved. |
@@ -25,7 +25,7 @@ | |||
25 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | .\" | 27 | .\" |
28 | .Dd $Mdocdate: February 23 2010 $ | 28 | .Dd $Mdocdate: July 3 2010 $ |
29 | .Dt NC 1 | 29 | .Dt NC 1 |
30 | .Os | 30 | .Os |
31 | .Sh NAME | 31 | .Sh NAME |
@@ -42,7 +42,7 @@ | |||
42 | .Op Fl p Ar source_port | 42 | .Op Fl p Ar source_port |
43 | .Op Fl s Ar source_ip_address | 43 | .Op Fl s Ar source_ip_address |
44 | .Op Fl T Ar ToS | 44 | .Op Fl T Ar ToS |
45 | .Op Fl V Ar rdomain | 45 | .Op Fl V Ar rtable |
46 | .Op Fl w Ar timeout | 46 | .Op Fl w Ar timeout |
47 | .Op Fl X Ar proxy_protocol | 47 | .Op Fl X Ar proxy_protocol |
48 | .Oo Xo | 48 | .Oo Xo |
@@ -179,8 +179,8 @@ Specifies to use | |||
179 | sockets. | 179 | sockets. |
180 | .It Fl u | 180 | .It Fl u |
181 | Use UDP instead of the default option of TCP. | 181 | Use UDP instead of the default option of TCP. |
182 | .It Fl V Ar rdomain | 182 | .It Fl V Ar rtable |
183 | Set the routing domain. | 183 | Set the routing table to be used. |
184 | The default is 0. | 184 | The default is 0. |
185 | .It Fl v | 185 | .It Fl v |
186 | Have | 186 | Have |
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index df68805bd9..e471182b2a 100644 --- a/src/usr.bin/nc/netcat.c +++ b/src/usr.bin/nc/netcat.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: netcat.c,v 1.97 2010/04/20 07:28:28 nicm Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.98 2010/07/03 04:44:51 guenther Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> | 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> |
4 | * | 4 | * |
@@ -84,7 +84,7 @@ int Iflag; /* TCP receive buffer size */ | |||
84 | int Oflag; /* TCP send buffer size */ | 84 | int Oflag; /* TCP send buffer size */ |
85 | int Sflag; /* TCP MD5 signature option */ | 85 | int Sflag; /* TCP MD5 signature option */ |
86 | int Tflag = -1; /* IP Type of Service */ | 86 | int Tflag = -1; /* IP Type of Service */ |
87 | u_int rdomain; | 87 | u_int rtableid; |
88 | 88 | ||
89 | int timeout = -1; | 89 | int timeout = -1; |
90 | int family = AF_UNSPEC; | 90 | int family = AF_UNSPEC; |
@@ -189,10 +189,10 @@ main(int argc, char *argv[]) | |||
189 | uflag = 1; | 189 | uflag = 1; |
190 | break; | 190 | break; |
191 | case 'V': | 191 | case 'V': |
192 | rdomain = (unsigned int)strtonum(optarg, 0, | 192 | rtableid = (unsigned int)strtonum(optarg, 0, |
193 | RT_TABLEID_MAX, &errstr); | 193 | RT_TABLEID_MAX, &errstr); |
194 | if (errstr) | 194 | if (errstr) |
195 | errx(1, "rdomain %s: %s", errstr, optarg); | 195 | errx(1, "rtable %s: %s", errstr, optarg); |
196 | break; | 196 | break; |
197 | case 'v': | 197 | case 'v': |
198 | vflag = 1; | 198 | vflag = 1; |
@@ -507,10 +507,10 @@ remote_connect(const char *host, const char *port, struct addrinfo hints) | |||
507 | res0->ai_protocol)) < 0) | 507 | res0->ai_protocol)) < 0) |
508 | continue; | 508 | continue; |
509 | 509 | ||
510 | if (rdomain) { | 510 | if (rtableid) { |
511 | if (setsockopt(s, IPPROTO_IP, SO_RDOMAIN, &rdomain, | 511 | if (setsockopt(s, IPPROTO_IP, SO_RTABLE, &rtableid, |
512 | sizeof(rdomain)) == -1) | 512 | sizeof(rtableid)) == -1) |
513 | err(1, "setsockopt SO_RDOMAIN"); | 513 | err(1, "setsockopt SO_RTABLE"); |
514 | } | 514 | } |
515 | 515 | ||
516 | /* Bind to a local port or source address if specified. */ | 516 | /* Bind to a local port or source address if specified. */ |
@@ -581,10 +581,10 @@ local_listen(char *host, char *port, struct addrinfo hints) | |||
581 | res0->ai_protocol)) < 0) | 581 | res0->ai_protocol)) < 0) |
582 | continue; | 582 | continue; |
583 | 583 | ||
584 | if (rdomain) { | 584 | if (rtableid) { |
585 | if (setsockopt(s, IPPROTO_IP, SO_RDOMAIN, &rdomain, | 585 | if (setsockopt(s, IPPROTO_IP, SO_RTABLE, &rtableid, |
586 | sizeof(rdomain)) == -1) | 586 | sizeof(rtableid)) == -1) |
587 | err(1, "setsockopt SO_RDOMAIN"); | 587 | err(1, "setsockopt SO_RTABLE"); |
588 | } | 588 | } |
589 | 589 | ||
590 | ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); | 590 | ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); |
@@ -871,7 +871,7 @@ help(void) | |||
871 | \t-t Answer TELNET negotiation\n\ | 871 | \t-t Answer TELNET negotiation\n\ |
872 | \t-U Use UNIX domain socket\n\ | 872 | \t-U Use UNIX domain socket\n\ |
873 | \t-u UDP mode\n\ | 873 | \t-u UDP mode\n\ |
874 | \t-V rdomain Specify alternate routing domain\n\ | 874 | \t-V rtable Specify alternate routing table\n\ |
875 | \t-v Verbose\n\ | 875 | \t-v Verbose\n\ |
876 | \t-w secs\t Timeout for connects and final net reads\n\ | 876 | \t-w secs\t Timeout for connects and final net reads\n\ |
877 | \t-X proto Proxy protocol: \"4\", \"5\" (SOCKS) or \"connect\"\n\ | 877 | \t-X proto Proxy protocol: \"4\", \"5\" (SOCKS) or \"connect\"\n\ |
@@ -887,7 +887,7 @@ usage(int ret) | |||
887 | fprintf(stderr, | 887 | fprintf(stderr, |
888 | "usage: nc [-46DdhklnrStUuvz] [-I length] [-i interval] [-O length]\n" | 888 | "usage: nc [-46DdhklnrStUuvz] [-I length] [-i interval] [-O length]\n" |
889 | "\t [-P proxy_username] [-p source_port] [-s source_ip_address] [-T ToS]\n" | 889 | "\t [-P proxy_username] [-p source_port] [-s source_ip_address] [-T ToS]\n" |
890 | "\t [-V rdomain] [-w timeout] [-X proxy_protocol]\n" | 890 | "\t [-V rtable] [-w timeout] [-X proxy_protocol]\n" |
891 | "\t [-x proxy_address[:port]] [hostname] [port]\n"); | 891 | "\t [-x proxy_address[:port]] [hostname] [port]\n"); |
892 | if (ret) | 892 | if (ret) |
893 | exit(1); | 893 | exit(1); |