]> git.proxmox.com Git - mirror_frr.git/blob - ripngd/ripng_nexthop.h
Merge pull request #13149 from pushpasis/mgmt_cleanup_zlog
[mirror_frr.git] / ripngd / ripng_nexthop.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* RIPng nexthop support
3 * Copyright (C) 6WIND Vincent Jardin <vincent.jardin@6wind.com>
4 */
5
6 #ifndef _ZEBRA_RIPNG_RIPNG_NEXTHOP_H
7 #define _ZEBRA_RIPNG_RIPNG_NEXTHOP_H
8
9 #include <zebra.h>
10 #include "linklist.h"
11 #include "ripngd/ripng_route.h"
12 #include "ripngd/ripngd.h"
13
14 extern struct list *ripng_rte_new(void);
15 extern void ripng_rte_free(struct list *ripng_rte_list);
16 extern void ripng_rte_add(struct list *ripng_rte_list, struct prefix_ipv6 *p,
17 struct ripng_info *rinfo,
18 struct ripng_aggregate *aggregate);
19 extern void ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp,
20 struct sockaddr_in6 *to);
21
22 /***
23 * 1 if A > B
24 * 0 if A = B
25 * -1 if A < B
26 **/
27 static inline int addr6_cmp(struct in6_addr *A, struct in6_addr *B)
28 {
29 #define a(i) A->s6_addr32[i]
30 #define b(i) B->s6_addr32[i]
31
32 if (a(3) > b(3))
33 return 1;
34 else if ((a(3) == b(3)) && (a(2) > b(2)))
35 return 1;
36 else if ((a(3) == b(3)) && (a(2) == b(2)) && (a(1) > b(1)))
37 return 1;
38 else if ((a(3) == b(3)) && (a(2) == b(2)) && (a(1) == b(1))
39 && (a(0) > b(0)))
40 return 1;
41
42 if ((a(3) == b(3)) && (a(2) == b(2)) && (a(1) == b(1))
43 && (a(0) == b(0)))
44 return 0;
45
46 return -1;
47 }
48
49 #endif /* _ZEBRA_RIPNG_RIPNG_NEXTHOP_H */