diff options
author | is <is> | 1999-09-07 13:22:00 +0000 |
---|---|---|
committer | is <is> | 1999-09-07 13:22:00 +0000 |
commit | 18d48c9e4bd2b3da3e03a0f94c938896a5ff4c1b (patch) | |
tree | 5021a8484497579dc797c5ab6d56125faf930b4c /net/netcat/patches | |
parent | b0728878bf110acfa56117b49558c59bc86abc72 (diff) | |
download | pkgsrc-18d48c9e4bd2b3da3e03a0f94c938896a5ff4c1b.tar.gz |
Fixes to allow testing with IPv4 broadcast addresses:
- use inet_ntoa instead of inet_addr, so that an error is different from
a possible return value
- add "-b" option, to switch on SO_BROADCAST (to allow sending broadcasts)
Diffstat (limited to 'net/netcat/patches')
-rw-r--r-- | net/netcat/patches/patch-aa | 23 | ||||
-rw-r--r-- | net/netcat/patches/patch-ab | 41 |
2 files changed, 64 insertions, 0 deletions
diff --git a/net/netcat/patches/patch-aa b/net/netcat/patches/patch-aa new file mode 100644 index 00000000000..9813b68ab0b --- /dev/null +++ b/net/netcat/patches/patch-aa @@ -0,0 +1,23 @@ +$NetBSD: patch-aa,v 1.1 1999/09/07 13:22:00 is Exp $ +--- netcat.c.original Tue Sep 7 14:33:35 1999 ++++ netcat.c Tue Sep 7 14:35:50 1999 +@@ -333,6 +333,7 @@ + struct in_addr iaddr; + register HINF * poop = NULL; + register int x; ++ int rc; + + /* I really want to strangle the twit who dreamed up all these sockaddr and + hostent abstractions, and then forced them all to be incompatible with +@@ -361,9 +362,9 @@ + bail ("gethostpoop fuxored"); + strcpy (poop->name, unknown); /* preload it */ + /* see wzv:workarounds.c for dg/ux return-a-struct inet_addr lossage */ +- iaddr.s_addr = inet_addr (name); ++ rc = inet_aton(name, &iaddr); + +- if (iaddr.s_addr == INADDR_NONE) { /* here's the great split: names... */ ++ if (rc == 0) { /* here's the great split: names... */ + if (numeric) + bail ("Can't parse %s as an IP address", name); + hostent = gethostbyname (name); diff --git a/net/netcat/patches/patch-ab b/net/netcat/patches/patch-ab new file mode 100644 index 00000000000..f2b625abf63 --- /dev/null +++ b/net/netcat/patches/patch-ab @@ -0,0 +1,41 @@ +$NetBSD: patch-ab,v 1.1 1999/09/07 13:22:00 is Exp $ +--- netcat.c.orig Tue Sep 7 14:43:01 1999 ++++ netcat.c Tue Sep 7 14:51:37 1999 +@@ -151,6 +151,7 @@ + + /* global cmd flags: */ + USHORT o_alla = 0; ++USHORT o_allowbroad = 0; + unsigned int o_interval = 0; + USHORT o_listen = 0; + USHORT o_nflag = 0; +@@ -621,6 +622,13 @@ + rr = setsockopt (nnetfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof (x)); + if (rr == -1) + holler ("nnetfd reuseaddr failed"); /* ??? */ ++#ifdef SO_BROADCAST ++ if (o_allowbroad) { ++ rr = setsockopt (nnetfd, SOL_SOCKET, SO_BROADCAST, &x, sizeof (x)); ++ if (rr == -1) ++ holler ("nnetfd reuseaddr failed"); /* ??? */ ++ } ++#endif + #ifdef SO_REUSEPORT /* doesnt exist everywhere... */ + rr = setsockopt (nnetfd, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x)); + if (rr == -1) +@@ -1390,12 +1398,14 @@ + + /* If your shitbox doesn't have getopt, step into the nineties already. */ + /* optarg, optind = next-argv-component [i.e. flag arg]; optopt = last-char */ +- while ((x = getopt (argc, argv, "ae:g:G:hi:lno:p:rs:tuvw:z")) != EOF) { ++ while ((x = getopt (argc, argv, "abe:g:G:hi:lno:p:rs:tuvw:z")) != EOF) { + /* Debug (("in go: x now %c, optarg %x optind %d", x, optarg, optind)) */ + switch (x) { + case 'a': + bail ("all-A-records NIY"); + o_alla++; break; ++ case 'b': ++ o_allowbroad++; break; + #ifdef GAPING_SECURITY_HOLE + case 'e': /* prog to exec */ + pr00gie = optarg; |