Browse Source

Log source address for 'malformed packet' errors. ok henning@

OPENBSD_3_9
dtucker 19 years ago
parent
commit
73c6d5ec9f
4 changed files with 10 additions and 9 deletions
  1. +2
    -2
      src/usr.sbin/ntpd/client.c
  2. +4
    -3
      src/usr.sbin/ntpd/ntp_msg.c
  3. +2
    -2
      src/usr.sbin/ntpd/ntpd.h
  4. +2
    -2
      src/usr.sbin/ntpd/server.c

+ 2
- 2
src/usr.sbin/ntpd/client.c View File

@ -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)


+ 4
- 3
src/usr.sbin/ntpd/ntp_msg.c View File

@ -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);
}


+ 2
- 2
src/usr.sbin/ntpd/ntpd.h View File

@ -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 */


+ 2
- 2
src/usr.sbin/ntpd/server.c View File

@ -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;


Loading…
Cancel
Save