diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-01-12 19:22:47 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-01-12 19:22:47 +0000 |
commit | da43ae4070286f4e8ab60e048893defe5cd48589 (patch) | |
tree | afb785cb9deedceebef934e1ef86124d98a3b43b /net_dgpsip.c | |
parent | 4d8ecc5b743a2d436daf9bb60232e09d5d02ab5c (diff) | |
download | gpsd-da43ae4070286f4e8ab60e048893defe5cd48589.tar.gz |
Internal IPv6 support, derived from a support patch by Olivier Mehani.
The patch original is at:
https://lists.berlios.de/pipermail/gpsd-dev/attachments/20100111/85ad4e15/attachment.bin
This revision changes netlib_connectsock() to take a first argument that is
an address family and can specify IPv4, IPv6, or either. It also changes
gpsd.c to open two client sockets, one IPv4 and one IPv6, and listen
on both.
As a required cleanup, a number of defaults to "127.0.0.1" become
defaults to "localhost" so we're not hardwiring in IPv4 assumptions
anymore.
I've omitted a significant portion of the Mehani patch that changed the
interface of the client library in an incompatible way. Currently there is
no way to make gpsd listen to IPv4 or IPv6 only, and no way to make a
client query over IPV4 or IPv6 only. Also, we'd really like to be able to
condition out IPv6 or (someday) IPv4 support for a leaner runtime, and
there's no way to do that yet, either.
Under IPv4, regression tests pass; live operation with a GPS mouse and
the aishub feed both work. However, the resulting code does not splint
clean; this will need to be fixed, and that's going to be tricky due
to the new sockaddr_t struct.
Diffstat (limited to 'net_dgpsip.c')
-rw-r--r-- | net_dgpsip.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net_dgpsip.c b/net_dgpsip.c index 9829d2bb..94f2de4f 100644 --- a/net_dgpsip.c +++ b/net_dgpsip.c @@ -6,6 +6,8 @@ #ifndef S_SPLINT_S #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> + #else + #define AF_UNSPEC 0 #endif /* HAVE_SYS_SOCKET_H */ #include <unistd.h> #endif /* S_SPLINT_S */ @@ -38,7 +40,7 @@ int dgpsip_open(struct gps_context_t *context, const char *dgpsserver) if (!getservbyname(dgpsport, "tcp")) dgpsport = DEFAULT_RTCM_PORT; - context->dsock = netlib_connectsock(dgpsserver, dgpsport, "tcp"); + context->dsock = netlib_connectsock(AF_UNSPEC, dgpsserver, dgpsport, "tcp"); if (context->dsock >= 0) { gpsd_report(LOG_PROG,"connection to DGPS server %s established.\n",dgpsserver); (void)gethostname(hn, sizeof(hn)); |