1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-02 01:20:54 +00:00

Add a patch that sends a probe packet to the server when setting up the

client socket.  It helps in a few cases where the server has multiple
addresses, only some of them are reachable, and connect() succeeds even
though sendto() will fail.

Approved by:	maintainer
This commit is contained in:
Dag-Erling Smørgrav 2017-11-29 13:12:24 +00:00
parent b8f7cc606a
commit ea0f1337b8
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=455109
3 changed files with 33 additions and 0 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= collectd
PORTVERSION= 5.8.0
PORTREVISION= 1
CATEGORIES= net-mgmt
MASTER_SITES= https://storage.googleapis.com/collectd-tarballs/
PKGNAMESUFFIX= 5

View File

@ -0,0 +1,16 @@
--- src/libcollectdclient/network.c.orig
+++ src/libcollectdclient/network.c
@@ -174,6 +174,13 @@
continue;
}
+ status = sendto(srv->fd, "", 1, 0, ai_ptr->ai_addr, ai_ptr->ai_addrlen);
+ if (status != 1) {
+ close(srv->fd);
+ srv->fd = -1;
+ continue;
+ }
+
srv->sa = malloc(ai_ptr->ai_addrlen);
if (srv->sa == NULL) {
close(srv->fd);

View File

@ -0,0 +1,16 @@
--- src/network.c.orig
+++ src/network.c
@@ -2000,6 +2000,13 @@
continue;
}
+ status = sendto(client->fd, "", 1, 0, ai_ptr->ai_addr, ai_ptr->ai_addrlen);
+ if (status != 1) {
+ close(client->fd);
+ client->fd = -1;
+ continue;
+ }
+
client->addr = calloc(1, sizeof(*client->addr));
if (client->addr == NULL) {
ERROR("network plugin: calloc failed.");