babeld: Use enum instead of #defines for kernel route type information

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2018-06-18 13:42:21 -04:00 committed by David Lamparter
parent 1314370166
commit e8c8f2e064
2 changed files with 14 additions and 15 deletions

View File

@ -73,9 +73,9 @@ kernel_interface_wireless(struct interface *interface)
}
int
kernel_route(int operation, const unsigned char *pref, unsigned short plen,
const unsigned char *gate, int ifindex, unsigned int metric,
const unsigned char *newgate, int newifindex,
kernel_route(enum babel_kernel_routes operation, const unsigned char *pref,
unsigned short plen, const unsigned char *gate, int ifindex,
unsigned int metric, const unsigned char *newgate, int newifindex,
unsigned int newmetric)
{
int rc;
@ -116,12 +116,9 @@ kernel_route(int operation, const unsigned char *pref, unsigned short plen,
newmetric);
return rc;
break;
default:
zlog_err("this should never happen (false value - kernel_route)");
assert(0);
exit(1);
break;
}
return 0;
}
static int

View File

@ -29,17 +29,19 @@ THE SOFTWARE.
#define KERNEL_INFINITY 0xFFFF
#define ROUTE_FLUSH 0
#define ROUTE_ADD 1
#define ROUTE_MODIFY 2
enum babel_kernel_routes {
ROUTE_FLUSH,
ROUTE_ADD,
ROUTE_MODIFY,
};
int kernel_interface_operational(struct interface *interface);
int kernel_interface_mtu(struct interface *interface);
int kernel_interface_wireless(struct interface *interface);
int kernel_route(int operation, const unsigned char *dest, unsigned short plen,
const unsigned char *gate, int ifindex, unsigned int metric,
const unsigned char *newgate, int newifindex,
unsigned int newmetric);
int kernel_route(enum babel_kernel_routes operation, const unsigned char *dest,
unsigned short plen, const unsigned char *gate, int ifindex,
unsigned int metric, const unsigned char *newgate,
int newifindex, unsigned int newmetric);
int if_eui64(int ifindex, unsigned char *eui);
int gettime(struct timeval *tv);
int read_random_bytes(void *buf, size_t len);