2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

lldp: Use OVS time functions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2015-03-03 15:34:07 -08:00
parent 4eb6eec6f8
commit d9f3b69e7c
2 changed files with 6 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
/* -*- mode: c; c-file-style: "openbsd" -*- */ /* -*- mode: c; c-file-style: "openbsd" -*- */
/* /*
* Copyright (c) 2015 Nicira, Inc.
* Copyright (c) 2008 Vincent Bernat <bernat@luffy.cx> * Copyright (c) 2008 Vincent Bernat <bernat@luffy.cx>
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
@@ -18,9 +19,9 @@
#include <config.h> #include <config.h>
#include "lldpd-structs.h" #include "lldpd-structs.h"
#include <stdlib.h> #include <stdlib.h>
#include <time.h>
#include <unistd.h> #include <unistd.h>
#include "lldpd.h" #include "lldpd.h"
#include "timeval.h"
VLOG_DEFINE_THIS_MODULE(lldpd_structs); VLOG_DEFINE_THIS_MODULE(lldpd_structs);
@@ -69,7 +70,7 @@ lldpd_remote_cleanup(struct lldpd_hardware *hw,
{ {
struct lldpd_port *port, *port_next; struct lldpd_port *port, *port_next;
int del; int del;
time_t now = time(NULL); time_t now = time_now();
VLOG_DBG("cleanup remote port on %s", hw->h_ifname); VLOG_DBG("cleanup remote port on %s", hw->h_ifname);
LIST_FOR_EACH_SAFE (port, port_next, p_entries, &hw->h_rports.p_entries) { LIST_FOR_EACH_SAFE (port, port_next, p_entries, &hw->h_rports.p_entries) {

View File

@@ -30,7 +30,6 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <time.h>
#include <unistd.h> #include <unistd.h>
#ifndef _WIN32 #ifndef _WIN32
#include <grp.h> #include <grp.h>
@@ -43,6 +42,7 @@
#include "compiler.h" #include "compiler.h"
#include "list.h" #include "list.h"
#include "packets.h" #include "packets.h"
#include "timeval.h"
VLOG_DEFINE_THIS_MODULE(lldpd); VLOG_DEFINE_THIS_MODULE(lldpd);
@@ -268,7 +268,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s,
(memcmp(oport->p_lastframe->frame, frame, s) == 0)) { (memcmp(oport->p_lastframe->frame, frame, s) == 0)) {
/* Already received the same frame */ /* Already received the same frame */
VLOG_DBG("duplicate frame, no need to decode"); VLOG_DBG("duplicate frame, no need to decode");
oport->p_lastupdate = time(NULL); oport->p_lastupdate = time_now();
return; return;
} }
} }
@@ -385,7 +385,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s,
} }
/* Add port */ /* Add port */
port->p_lastchange = port->p_lastupdate = time(NULL); port->p_lastchange = port->p_lastupdate = time_now();
port->p_lastframe = xmalloc(s + sizeof(struct lldpd_frame)); port->p_lastframe = xmalloc(s + sizeof(struct lldpd_frame));
port->p_lastframe->size = s; port->p_lastframe->size = s;
memcpy(port->p_lastframe->frame, frame, s); memcpy(port->p_lastframe->frame, frame, s);