diff options
author | Chris Kuethe <chris.kuethe@gmail.com> | 2008-12-26 15:33:10 +0000 |
---|---|---|
committer | Chris Kuethe <chris.kuethe@gmail.com> | 2008-12-26 15:33:10 +0000 |
commit | 5b95b4dd8f66a1317350dac059632f8f79d9d4aa (patch) | |
tree | 388ec74630410b8d1f022b09985279a9981781c0 /gpsd.c | |
parent | 2a8da1e863f114ce4cdf4d568db5c68baf0296d9 (diff) | |
download | gpsd-5b95b4dd8f66a1317350dac059632f8f79d9d4aa.tar.gz |
Greg Troxel's patch to allow the user to decide whether to listen on the
loopback or to any address, making the gpsd instance world-readable. A
bit more manpage fluff from me. We will probably change this in the future
to accomodate ipv6 and multiple listener addresses.
Diffstat (limited to 'gpsd.c')
-rw-r--r-- | gpsd.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -87,6 +87,7 @@ static fd_set all_fds; static int maxfd; static int debuglevel; static bool in_background = false; +static bool listen_global = false; static bool nowait = true; static jmp_buf restartbuf; /*@ -initallelements -nullassign -nullderef @*/ @@ -230,7 +231,10 @@ static int passivesock(char *service, char *protocol, int qlen) /*@ -mustfreefresh @*/ memset((char *) &sin, 0, sizeof(sin)); sin.sin_family = (sa_family_t)AF_INET; - sin.sin_addr.s_addr = htonl(INADDR_ANY); + if (listen_global) + sin.sin_addr.s_addr = htonl(INADDR_ANY); + else + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); if ((pse = getservbyname(service, protocol))) sin.sin_port = htons(ntohs((in_port_t)pse->s_port)); @@ -1274,7 +1278,7 @@ int main(int argc, char *argv[]) (void)setlocale(LC_NUMERIC, "C"); #endif debuglevel = 0; - while ((option = getopt(argc, argv, "F:D:S:bhNnP:V" + while ((option = getopt(argc, argv, "F:D:S:bGhNnP:V" #ifdef RTCM104_SERVICE "R:" #endif /* RTCM104_SERVICE */ @@ -1292,6 +1296,9 @@ int main(int argc, char *argv[]) case 'b': context.readonly = true; break; + case 'G': + listen_global = true; + break; #ifdef RTCM104_SERVICE case 'R': rtcm_service = optarg; |