Date: Sun, 16 Apr 2017 03:12:08 +0000 (UTC) From: Stephen Hurd <shurd@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r438615 - in head/comms/hamlib: . files Message-ID: <201704160312.v3G3C8cX076161@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: shurd Date: Sun Apr 16 03:12:08 2017 New Revision: 438615 URL: https://svnweb.freebsd.org/changeset/ports/438615 Log: Small fixes for rig type 2 1) Disable Nagle on the socket since all queries are sent as a single string 2) Stop using sizeof("\n") to get the length of the string "\n" These need to be submitted upstream as well. Added: head/comms/hamlib/files/patch-dummy_netrigctl.c (contents, props changed) head/comms/hamlib/files/patch-src_network.c (contents, props changed) Modified: head/comms/hamlib/Makefile Modified: head/comms/hamlib/Makefile ============================================================================== --- head/comms/hamlib/Makefile Sun Apr 16 02:40:18 2017 (r438614) +++ head/comms/hamlib/Makefile Sun Apr 16 03:12:08 2017 (r438615) @@ -3,6 +3,7 @@ PORTNAME= hamlib PORTVERSION= 3.1 +PORTREVISION= 1 CATEGORIES= comms hamradio MASTER_SITES= SF Added: head/comms/hamlib/files/patch-dummy_netrigctl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/comms/hamlib/files/patch-dummy_netrigctl.c Sun Apr 16 03:12:08 2017 (r438615) @@ -0,0 +1,177 @@ +--- dummy/netrigctl.c.orig 2017-04-16 02:56:42 UTC ++++ dummy/netrigctl.c +@@ -54,7 +54,7 @@ static int netrigctl_transaction(RIG *ri + if (ret != RIG_OK) + return ret; + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret < 0) + return ret; + +@@ -87,18 +87,18 @@ static int netrigctl_open(RIG *rig) + if (prot_ver < RIGCTLD_PROT_VER) + return -RIG_EPROTO; + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + + rs->itu_region = atoi(buf); + + for (i=0; i<FRQRANGESIZ; i++) { +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + +@@ -117,7 +117,7 @@ static int netrigctl_open(RIG *rig) + break; + } + for (i=0; i<FRQRANGESIZ; i++) { +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + +@@ -136,7 +136,7 @@ static int netrigctl_open(RIG *rig) + break; + } + for (i=0; i<TSLSTSIZ; i++) { +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + +@@ -150,7 +150,7 @@ static int netrigctl_open(RIG *rig) + } + + for (i=0; i<FLTLSTSIZ; i++) { +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + +@@ -168,31 +168,31 @@ static int netrigctl_open(RIG *rig) + chan_t chan_list[CHANLSTSIZ]; /*!< Channel list, zero ended */ + #endif + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + + rs->max_rit = atol(buf); + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + + rs->max_xit = atol(buf); + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + + rs->max_ifshift = atol(buf); + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + + rs->announces = atoi(buf); + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + +@@ -205,7 +205,7 @@ chan_t chan_list[CHANLSTSIZ]; /*!< Chann + ret = 0; + rs->preamp[ret] = RIG_DBLST_END; + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + +@@ -218,37 +218,37 @@ chan_t chan_list[CHANLSTSIZ]; /*!< Chann + ret = 0; + rs->attenuator[ret] = RIG_DBLST_END; + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + + rs->has_get_func = strtol(buf, NULL, 0); + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + + rs->has_set_func = strtol(buf, NULL, 0); + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + + rs->has_get_level = strtol(buf, NULL, 0); + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + + rs->has_set_level = strtol(buf, NULL, 0); + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + + rs->has_get_parm = strtol(buf, NULL, 0); + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + +@@ -354,7 +354,7 @@ static int netrigctl_get_mode(RIG *rig, + if (ret > 0 && buf[ret-1]=='\n') buf[ret-1] = '\0'; /* chomp */ + *mode = rig_parse_mode(buf); + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + +@@ -761,7 +761,7 @@ static int netrigctl_get_split_mode(RIG + if (ret > 0 && buf[ret-1]=='\n') buf[ret-1] = '\0'; /* chomp */ + *tx_mode = rig_parse_mode(buf); + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + +@@ -804,7 +804,7 @@ static int netrigctl_get_split_vfo(RIG * + + *split = atoi(buf); + +- ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); ++ ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); + if (ret <= 0) + return (ret < 0) ? ret : -RIG_EPROTO; + Added: head/comms/hamlib/files/patch-src_network.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/comms/hamlib/files/patch-src_network.c Sun Apr 16 03:12:08 2017 (r438615) @@ -0,0 +1,29 @@ +--- src/network.c.orig 2016-12-31 20:01:25 UTC ++++ src/network.c +@@ -48,6 +48,7 @@ + + #ifdef HAVE_NETINET_IN_H + #include <netinet/in.h> ++#include <netinet/tcp.h> + #endif + #if HAVE_NETDB_H + #include <netdb.h> +@@ -117,6 +118,7 @@ int network_open(hamlib_port_t *rp, int + { + int fd; /* File descriptor for the port */ + int status; ++ int flag; + struct addrinfo hints, *res, *saved_res; + char *hoststr = NULL, *portstr = NULL, *bracketstr1, *bracketstr2; + char hostname[FILPATHLEN]; +@@ -202,6 +204,10 @@ int network_open(hamlib_port_t *rp, int + return -RIG_EIO; + } + ++ /* Disable Nagle */ ++ flag = 1; ++ setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(flag)); ++ + if ((status = connect(fd, res->ai_addr, res->ai_addrlen)) == 0) + { + break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704160312.v3G3C8cX076161>