diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2005-09-24 00:32:04 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2005-09-24 00:32:04 +0000 |
commit | efd68f6b797fecb5e8fed90cb478d27bdd9fee19 (patch) | |
tree | 1c647431cfd5436e9f6d5e715aa7b967060b0682 /usr.sbin/ntpd | |
parent | c2852f2e169ac0a6678b9a237555ed5c4f546ac4 (diff) |
Log source address for 'malformed packet' errors. ok henning@
Diffstat (limited to 'usr.sbin/ntpd')
-rw-r--r-- | usr.sbin/ntpd/client.c | 4 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntp_msg.c | 7 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntpd.h | 4 | ||||
-rw-r--r-- | usr.sbin/ntpd/server.c | 4 |
4 files changed, 10 insertions, 9 deletions
diff --git a/usr.sbin/ntpd/client.c b/usr.sbin/ntpd/client.c index 0f186d971fd..208672bfa8e 100644 --- a/usr.sbin/ntpd/client.c +++ b/usr.sbin/ntpd/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.65 2005/08/10 13:48:36 dtucker Exp $ */ +/* $OpenBSD: client.c,v 1.66 2005/09/24 00:32:03 dtucker Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -198,7 +198,7 @@ client_dispatch(struct ntp_peer *p, u_int8_t settime) T4 = gettime(); - ntp_getmsg(buf, size, &msg); + ntp_getmsg((struct sockaddr *)&p->addr->ss, buf, size, &msg); if (msg.orgtime.int_partl != p->query->msg.xmttime.int_partl || msg.orgtime.fractionl != p->query->msg.xmttime.fractionl) diff --git a/usr.sbin/ntpd/ntp_msg.c b/usr.sbin/ntpd/ntp_msg.c index 2471319481a..99554c92774 100644 --- a/usr.sbin/ntpd/ntp_msg.c +++ b/usr.sbin/ntpd/ntp_msg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp_msg.c,v 1.14 2004/12/14 06:27:13 dtucker Exp $ */ +/* $OpenBSD: ntp_msg.c,v 1.15 2005/09/24 00:32:03 dtucker Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -27,10 +27,11 @@ #include "ntp.h" int -ntp_getmsg(char *p, ssize_t len, struct ntp_msg *msg) +ntp_getmsg(struct sockaddr *sa, char *p, ssize_t len, struct ntp_msg *msg) { if (len != NTP_MSGSIZE_NOAUTH && len != NTP_MSGSIZE) { - log_warnx("malformed packet received"); + log_warnx("malformed packet received from %s", + log_sockaddr(sa)); return (-1); } diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h index 58b787bf636..fabca3a3033 100644 --- a/usr.sbin/ntpd/ntpd.h +++ b/usr.sbin/ntpd/ntpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.h,v 1.60 2005/08/10 13:48:36 dtucker Exp $ */ +/* $OpenBSD: ntpd.h,v 1.61 2005/09/24 00:32:03 dtucker Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -231,7 +231,7 @@ int host_dns(const char *, struct ntp_addr **); struct ntp_peer *new_peer(void); /* ntp_msg.c */ -int ntp_getmsg(char *, ssize_t, struct ntp_msg *); +int ntp_getmsg(struct sockaddr *, char *, ssize_t, struct ntp_msg *); int ntp_sendmsg(int, struct sockaddr *, struct ntp_msg *, ssize_t, int); /* server.c */ diff --git a/usr.sbin/ntpd/server.c b/usr.sbin/ntpd/server.c index e580fb0dca2..0096aa07606 100644 --- a/usr.sbin/ntpd/server.c +++ b/usr.sbin/ntpd/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.25 2005/08/10 13:48:36 dtucker Exp $ */ +/* $OpenBSD: server.c,v 1.26 2005/09/24 00:32:03 dtucker Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -125,7 +125,7 @@ server_dispatch(int fd, struct ntpd_conf *conf) rectime = gettime(); - if (ntp_getmsg(buf, size, &query) == -1) + if (ntp_getmsg((struct sockaddr *)&fsa, buf, size, &query) == -1) return (0); version = (query.status & VERSIONMASK) >> 3; |