ndp: Prepare for pending tcpdump update
ndp makes use of gmt2local, however that library has been removed from tcpdump. Add utc_offset() as a substitute. Reviewed by: emaste, jhb, melifaro Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40445
This commit is contained in:
parent
1232c7884d
commit
1cdec2832d
@ -15,15 +15,13 @@
|
||||
|
||||
.include <src.opts.mk>
|
||||
|
||||
.PATH: ${SRCTOP}/contrib/tcpdump
|
||||
|
||||
PROG= ndp
|
||||
MAN= ndp.8
|
||||
SRCS= ndp.c gmt2local.c
|
||||
SRCS= ndp.c
|
||||
|
||||
LIBADD= xo
|
||||
|
||||
CFLAGS+= -I. -I${.CURDIR} -I${SRCTOP}/contrib/tcpdump
|
||||
CFLAGS+= -I. -I${.CURDIR}
|
||||
CFLAGS+= -D_U_=""
|
||||
|
||||
.if ${MK_EXPERIMENTAL} != "no"
|
||||
|
@ -98,6 +98,7 @@
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <errno.h>
|
||||
@ -107,11 +108,12 @@
|
||||
#include <string.h>
|
||||
#include <paths.h>
|
||||
#include <err.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <libxo/xo.h>
|
||||
#include "gmt2local.h"
|
||||
#include <time.h>
|
||||
|
||||
#include "ndp.h"
|
||||
|
||||
@ -181,6 +183,20 @@ valid_type(int if_type)
|
||||
return (false);
|
||||
}
|
||||
|
||||
static int32_t
|
||||
utc_offset(void)
|
||||
{
|
||||
time_t t;
|
||||
struct tm *tm;
|
||||
|
||||
t = time(NULL);
|
||||
tm = localtime(&t);
|
||||
|
||||
assert(tm->tm_gmtoff > INT32_MIN && tm->tm_gmtoff < INT32_MAX);
|
||||
|
||||
return (tm->tm_gmtoff);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@ -188,7 +204,7 @@ main(int argc, char **argv)
|
||||
char *arg = NULL;
|
||||
|
||||
pid = getpid();
|
||||
thiszone = gmt2local(0);
|
||||
thiszone = utc_offset();
|
||||
|
||||
argc = xo_parse_args(argc, argv);
|
||||
if (argc < 0)
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <libxo/xo.h>
|
||||
#include "gmt2local.h"
|
||||
|
||||
|
||||
#include <netlink/netlink.h>
|
||||
|
Loading…
Reference in New Issue
Block a user