]> git.proxmox.com Git - mirror_frr.git/blobdiff - ripngd/ripng_peer.c
ripngd: retrofit the 'router ripng' command to the new northbound model
[mirror_frr.git] / ripngd / ripng_peer.c
index 38d8831f5ebd56305a139b8c4b14799e97fb4e05..6b2a18353924921b6548a9ca877d567f1ef0c65e 100644 (file)
  * 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 GNU Zebra; see the file COPYING.  If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
  */
 
 /* RIPng support added by Vincent Jardin <vincent.jardin@6wind.com>
@@ -104,8 +103,9 @@ static struct ripng_peer *ripng_peer_get(struct in6_addr *addr)
        }
 
        /* Update timeout thread. */
-       peer->t_timeout = thread_add_timer(master, ripng_peer_timeout, peer,
-                                          RIPNG_PEER_TIMER_DEFAULT);
+       peer->t_timeout = NULL;
+       thread_add_timer(master, ripng_peer_timeout, peer,
+                        RIPNG_PEER_TIMER_DEFAULT, &peer->t_timeout);
 
        /* Last update time set. */
        time(&peer->uptime);
@@ -113,7 +113,7 @@ static struct ripng_peer *ripng_peer_get(struct in6_addr *addr)
        return peer;
 }
 
-void ripng_peer_update(struct sockaddr_in6 *from, u_char version)
+void ripng_peer_update(struct sockaddr_in6 *from, uint8_t version)
 {
        struct ripng_peer *peer;
        peer = ripng_peer_get(&from->sin6_addr);
@@ -151,10 +151,6 @@ static char *ripng_peer_uptime(struct ripng_peer *peer, char *buf, size_t len)
        uptime -= peer->uptime;
        tm = gmtime(&uptime);
 
-/* Making formatted timer strings. */
-#define ONE_DAY_SECOND 60*60*24
-#define ONE_WEEK_SECOND 60*60*24*7
-
        if (uptime < ONE_DAY_SECOND)
                snprintf(buf, len, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,
                         tm->tm_sec);
@@ -175,18 +171,16 @@ void ripng_peer_display(struct vty *vty)
        char timebuf[RIPNG_UPTIME_LEN];
 
        for (ALL_LIST_ELEMENTS(peer_list, node, nnode, peer)) {
-               vty_out(vty, "    %s %s%14s %10d %10d %10d      %s%s",
-                       inet6_ntoa(peer->addr), VTY_NEWLINE, " ",
-                       peer->recv_badpackets, peer->recv_badroutes,
-                       ZEBRA_RIPNG_DISTANCE_DEFAULT,
-                       ripng_peer_uptime(peer, timebuf, RIPNG_UPTIME_LEN),
-                       VTY_NEWLINE);
+               vty_out(vty, "    %s \n%14s %10d %10d %10d      %s\n",
+                       inet6_ntoa(peer->addr), " ", peer->recv_badpackets,
+                       peer->recv_badroutes, ZEBRA_RIPNG_DISTANCE_DEFAULT,
+                       ripng_peer_uptime(peer, timebuf, RIPNG_UPTIME_LEN));
        }
 }
 
 static int ripng_peer_list_cmp(struct ripng_peer *p1, struct ripng_peer *p2)
 {
-       return addr6_cmp(&p1->addr, &p2->addr) > 0;
+       return memcmp(&p1->addr, &p2->addr, sizeof(struct in6_addr));
 }
 
 void ripng_peer_init()