]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/network.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / lib / network.c
index b60ad9a57c3800f97bae4cdde4708c133bd15e29..af1c7db443e90cf5cb179e2a4ee461e409d8da7b 100644 (file)
@@ -1,22 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Network library.
  * Copyright (C) 1997 Kunihiro Ishiguro
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
@@ -122,3 +107,24 @@ float ntohf(float net)
 {
        return htonf(net);
 }
+
+uint64_t frr_sequence_next(void)
+{
+       static uint64_t last_sequence;
+       struct timespec ts;
+
+       (void)clock_gettime(CLOCK_MONOTONIC, &ts);
+       if (last_sequence == (uint64_t)ts.tv_sec) {
+               last_sequence++;
+               return last_sequence;
+       }
+
+       last_sequence = ts.tv_sec;
+       return last_sequence;
+}
+
+uint32_t frr_sequence32_next(void)
+{
+       /* coverity[Y2K38_SAFETY] */
+       return (uint32_t)frr_sequence_next();
+}