Add safety check.
This commit is contained in:
parent
98da26a0a0
commit
8b79c4ccd5
2 changed files with 7 additions and 1 deletions
|
@ -53,6 +53,7 @@
|
||||||
#include "lib/string.h"
|
#include "lib/string.h"
|
||||||
|
|
||||||
#include "rip.h"
|
#include "rip.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#define P ((struct rip_proto *) p)
|
#define P ((struct rip_proto *) p)
|
||||||
#define P_CF ((struct rip_proto_config *)p->cf)
|
#define P_CF ((struct rip_proto_config *)p->cf)
|
||||||
|
@ -538,6 +539,11 @@ rip_start(struct proto *p)
|
||||||
struct rip_interface *rif;
|
struct rip_interface *rif;
|
||||||
DBG( "RIP: starting instance...\n" );
|
DBG( "RIP: starting instance...\n" );
|
||||||
|
|
||||||
|
assert( sizeof(struct rip_packet_heading) == 4);
|
||||||
|
assert( sizeof(struct rip_block) == 20);
|
||||||
|
assert( sizeof(struct rip_block_auth) == 20);
|
||||||
|
|
||||||
|
|
||||||
P->magic = RIP_MAGIC;
|
P->magic = RIP_MAGIC;
|
||||||
fib_init( &P->rtable, p->pool, sizeof( struct rip_entry ), 0, NULL );
|
fib_init( &P->rtable, p->pool, sizeof( struct rip_entry ), 0, NULL );
|
||||||
init_list( &P->connections );
|
init_list( &P->connections );
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct rip_block { /* 20 bytes */
|
||||||
u32 metric;
|
u32 metric;
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
struct rip_block { /* IPv6 version! */
|
struct rip_block { /* IPv6 version!, 20 bytes, too */
|
||||||
ip_addr network;
|
ip_addr network;
|
||||||
u16 tag;
|
u16 tag;
|
||||||
u8 pxlen;
|
u8 pxlen;
|
||||||
|
|
Loading…
Reference in a new issue