summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormbalmer <mbalmer@openbsd.org>2007-11-27 10:06:55 +0000
committermbalmer <mbalmer@openbsd.org>2007-11-27 10:06:55 +0000
commit93a5de57e6bfa282ec3b6cba0b5df3cc15738da4 (patch)
tree472dc49fed472b0f1736a35f69c9df0f1e6e734b
parentfix typo (diff)
downloadwireguard-openbsd-93a5de57e6bfa282ec3b6cba0b5df3cc15738da4.tar.xz
wireguard-openbsd-93a5de57e6bfa282ec3b6cba0b5df3cc15738da4.zip
Only checksum the NMEA sentence if it as GPRMC message.
suggested by otto.
-rw-r--r--sys/kern/tty_nmea.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/tty_nmea.c b/sys/kern/tty_nmea.c
index 2ff72855f69..83e41a897ac 100644
--- a/sys/kern/tty_nmea.c
+++ b/sys/kern/tty_nmea.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_nmea.c,v 1.23 2007/11/26 19:14:38 mbalmer Exp $ */
+/* $OpenBSD: tty_nmea.c,v 1.24 2007/11/27 10:06:55 mbalmer Exp $ */
/*
* Copyright (c) 2006, 2007 Marc Balmer <mbalmer@openbsd.org>
@@ -242,6 +242,10 @@ nmea_scan(struct nmea *np, struct tty *tp)
}
}
+ /* we only look at the GPRMC message */
+ if (strcmp(fld[0], "GPRMC"))
+ return;
+
/* if we have a checksum, verify it */
if (cs != NULL) {
msgcksum = 0;
@@ -265,10 +269,7 @@ nmea_scan(struct nmea *np, struct tty *tp)
return;
}
}
-
- /* check message type */
- if (!strcmp(fld[0], "GPRMC"))
- nmea_gprmc(np, tp, fld, fldcnt);
+ nmea_gprmc(np, tp, fld, fldcnt);
}
/* Decode the recommended minimum specific GPS/TRANSIT data. */