diff options
| author | Kartik Naik <kartik@bugqore.com> | 2026-07-26 18:47:36 +0530 |
|---|---|---|
| committer | Kartik Naik <kartik@bugqore.com> | 2026-07-26 18:47:36 +0530 |
| commit | 2cb6e4f5215cada460aca50346478725bf754231 (patch) | |
| tree | 06d564cc7e043c5ad18066e044c2106637563e9e | |
| parent | 3d686a7cbd84221fde5d7e03fa47896f6abf1d6c (diff) | |
| download | portable-2cb6e4f5215cada460aca50346478725bf754231.tar.gz portable-2cb6e4f5215cada460aca50346478725bf754231.tar.bz2 portable-2cb6e4f5215cada460aca50346478725bf754231.zip | |
error out when nc minttl is unsupported in set_common_sockopts
| -rw-r--r-- | patches/netcat.c.patch | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/patches/netcat.c.patch b/patches/netcat.c.patch index 0383034..680f02b 100644 --- a/patches/netcat.c.patch +++ b/patches/netcat.c.patch | |||
| @@ -131,7 +131,7 @@ | |||
| 131 | } | 131 | } |
| 132 | if (Iflag) { | 132 | if (Iflag) { |
| 133 | if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, | 133 | if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, |
| 134 | @@ -1612,13 +1641,17 @@ set_common_sockopts(int s, int af) | 134 | @@ -1612,13 +1641,27 @@ set_common_sockopts(int s, int af) |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | if (minttl != -1) { | 137 | if (minttl != -1) { |
| @@ -139,6 +139,11 @@ | |||
| 139 | if (af == AF_INET && setsockopt(s, IPPROTO_IP, | 139 | if (af == AF_INET && setsockopt(s, IPPROTO_IP, |
| 140 | IP_MINTTL, &minttl, sizeof(minttl))) | 140 | IP_MINTTL, &minttl, sizeof(minttl))) |
| 141 | err(1, "set IP min TTL"); | 141 | err(1, "set IP min TTL"); |
| 142 | +#else | ||
| 143 | + if (af == AF_INET) { | ||
| 144 | + errno = ENOPROTOOPT; | ||
| 145 | + err(1, "set IP min TTL not supported"); | ||
| 146 | + } | ||
| 142 | +#endif | 147 | +#endif |
| 143 | 148 | ||
| 144 | - else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, | 149 | - else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, |
| @@ -146,11 +151,16 @@ | |||
| 146 | + if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, | 151 | + if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, |
| 147 | IPV6_MINHOPCOUNT, &minttl, sizeof(minttl))) | 152 | IPV6_MINHOPCOUNT, &minttl, sizeof(minttl))) |
| 148 | err(1, "set IPv6 min hop count"); | 153 | err(1, "set IPv6 min hop count"); |
| 154 | +#else | ||
| 155 | + if (af == AF_INET6) { | ||
| 156 | + errno = ENOPROTOOPT; | ||
| 157 | + err(1, "set IPv6 min hop count not supported"); | ||
| 158 | + } | ||
| 149 | +#endif | 159 | +#endif |
| 150 | } | 160 | } |
| 151 | } | 161 | } |
| 152 | 162 | ||
| 153 | @@ -1849,15 +1882,19 @@ help(void) | 163 | @@ -1849,15 +1892,19 @@ help(void) |
| 154 | \t-P proxyuser\tUsername for proxy authentication\n\ | 164 | \t-P proxyuser\tUsername for proxy authentication\n\ |
| 155 | \t-p port\t Specify local port for remote connects\n\ | 165 | \t-p port\t Specify local port for remote connects\n\ |
| 156 | \t-R CAfile CA bundle\n\ | 166 | \t-R CAfile CA bundle\n\ |
