]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
a94434b6 | 2 | /* RIPng nexthop support |
3 | * Copyright (C) 6WIND Vincent Jardin <vincent.jardin@6wind.com> | |
a94434b6 | 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 | ||
d62a17ae | 14 | extern struct list *ripng_rte_new(void); |
6ac29a51 PJ |
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, | |
d62a17ae | 17 | struct ripng_info *rinfo, |
18 | struct ripng_aggregate *aggregate); | |
6ac29a51 | 19 | extern void ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, |
d62a17ae | 20 | struct sockaddr_in6 *to); |
a94434b6 | 21 | |
22 | /*** | |
23 | * 1 if A > B | |
24 | * 0 if A = B | |
25 | * -1 if A < B | |
26 | **/ | |
d62a17ae | 27 | static inline int addr6_cmp(struct in6_addr *A, struct in6_addr *B) |
5c6ed111 | 28 | { |
a94434b6 | 29 | #define a(i) A->s6_addr32[i] |
30 | #define b(i) B->s6_addr32[i] | |
31 | ||
d62a17ae | 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; | |
a94434b6 | 41 | |
d62a17ae | 42 | if ((a(3) == b(3)) && (a(2) == b(2)) && (a(1) == b(1)) |
43 | && (a(0) == b(0))) | |
44 | return 0; | |
a94434b6 | 45 | |
d62a17ae | 46 | return -1; |
a94434b6 | 47 | } |
48 | ||
49 | #endif /* _ZEBRA_RIPNG_RIPNG_NEXTHOP_H */ |