568266e188
- Build with hidden visibility since no symbols should be exported - enable-udp-ip_recverr.patch: Enable IP_RECVERR on UDP sockets to match *bsd behaviour and avoid long timeouts if an error ocurrs. OBS-URL: https://build.opensuse.org/request/show/855992 OBS-URL: https://build.opensuse.org/package/show/network:utilities/netcat-openbsd?expand=0&rev=24
36 lines
808 B
Diff
36 lines
808 B
Diff
Index: netcat-openbsd-1.203/netcat.c
|
|
===================================================================
|
|
--- netcat-openbsd-1.203.orig/netcat.c
|
|
+++ netcat-openbsd-1.203/netcat.c
|
|
@@ -1889,6 +1889,21 @@ udptest(int s)
|
|
return 1;
|
|
}
|
|
|
|
+static int
|
|
+enable_icmp_errors (int family, int fd)
|
|
+{
|
|
+ int one = 1;
|
|
+ switch (family)
|
|
+ {
|
|
+ case AF_INET:
|
|
+ return setsockopt (fd, SOL_IP, IP_RECVERR, &one, sizeof (one));
|
|
+ case AF_INET6:
|
|
+ return setsockopt (fd, SOL_IPV6, IPV6_RECVERR, &one, sizeof (one));
|
|
+ default:
|
|
+ return -1;
|
|
+ }
|
|
+}
|
|
+
|
|
void
|
|
set_common_sockopts(int s, const struct sockaddr* sa)
|
|
{
|
|
@@ -1982,6 +1997,8 @@ set_common_sockopts(int s, const struct
|
|
errx(1, "can't set IPv6 min hop count (unavailable)");
|
|
#endif
|
|
}
|
|
+ if(uflag)
|
|
+ enable_icmp_errors(af,s);
|
|
}
|
|
|
|
int
|