extern int irdp_sock_init(void);
extern void irdp_finish(void);
extern void irdp_config_write (struct vty *, struct interface *);
+extern int irdp_send_thread(struct thread *t_advert);
+extern void irdp_advert_off(struct interface *ifp);
+extern void process_solicit (struct interface *ifp);
+extern int irdp_read_raw(struct thread *r);
+extern void send_packet(struct interface *ifp, struct stream *s,
+ u_int32_t dst, struct prefix *p, u_int32_t ttl);
+
#endif /* _IRDP_H */
/* Master of threads. */
extern struct zebra_t zebrad;
-int in_cksum (void *ptr, int nbytes);
extern int irdp_sock;
-int irdp_send_thread(struct thread *t_advert);
-char *inet_2a(u_int32_t a, char *b);
-void irdp_advert_off(struct interface *ifp);
+static const char *
+inet_2a(u_int32_t a, char *b)
+{
+ sprintf(b, "%u.%u.%u.%u",
+ (a ) & 0xFF,
+ (a>> 8) & 0xFF,
+ (a>>16) & 0xFF,
+ (a>>24) & 0xFF);
+ return b;
+}
-char b1[16], b2[16], b3[16], b4[16]; /* For inet_2a */
static struct prefix *
irdp_get_prefix(struct interface *ifp)
struct ip_mreq m;
struct prefix *p;
int ret;
+ char b1[INET_ADDRSTRLEN];
zi = ifp->info;
if (ret < 0)
zlog_warn ("IRDP: %s can't setsockopt %s: %s",
add_leave == IP_ADD_MEMBERSHIP? "join group":"leave group",
- inet_2a(group, b1),
- safe_strerror (errno));
+ inet_2a(group, b1),
+ safe_strerror (errno));
return ret;
}
struct zebra_if *zi= ifp->info;
struct irdp_interface *irdp = &zi->irdp;
int ret;
+ char b1[INET_ADDRSTRLEN];
ret = if_group (ifp, irdp_sock, INADDR_ALLRTRS_GROUP, IP_ADD_MEMBERSHIP);
if (ret < 0) {
struct zebra_if *zi= ifp->info;
struct irdp_interface *irdp = &zi->irdp;
int ret;
+ char b1[INET_ADDRSTRLEN];
ret = if_group (ifp, irdp_sock, INADDR_ALLRTRS_GROUP, IP_DROP_MEMBERSHIP);
if (ret < 0)
}
-struct Adv *Adv_new (void)
+static struct Adv *Adv_new (void)
{
return XCALLOC (MTYPE_TMP, sizeof (struct Adv));
}
struct irdp_interface *irdp=&zi->irdp;
struct Adv *adv;
struct listnode *node;
+ char b1[INET_ADDRSTRLEN];
if(irdp->flags & IF_ACTIVE || irdp->flags & IF_SHUTDOWN) {
#include "zebra/irdp.h"
#include <netinet/ip_icmp.h>
+#include "checksum.h"
#include "if.h"
#include "sockunion.h"
#include "log.h"
/* Timer interval of irdp. */
int irdp_timer_interval = IRDP_DEFAULT_INTERVAL;
-int irdp_read_raw(struct thread *r);
-int in_cksum (void *ptr, int nbytes);
-void send_packet(struct interface *ifp,
- struct stream *s,
- u_int32_t dst,
- struct prefix *p,
- u_int32_t ttl);
-
-char *
-inet_2a(u_int32_t a, char *b)
-{
- sprintf(b, "%u.%u.%u.%u",
- (a ) & 0xFF,
- (a>> 8) & 0xFF,
- (a>>16) & 0xFF,
- (a>>24) & 0xFF);
- return b;
-}
-
int
irdp_sock_init (void)
{
#include "zebra/irdp.h"
#include <netinet/ip_icmp.h>
#include "if.h"
+#include "checksum.h"
#include "sockunion.h"
#include "log.h"
#include "sockopt.h"
/* GLOBAL VARS */
int irdp_sock = -1;
-char b1[16], b2[16], b3[16], b4[16]; /* For inet_2a */
extern struct zebra_t zebrad;
extern struct thread *t_irdp_raw;
-int in_cksum (void *ptr, int nbytes);
-void process_solicit (struct interface *ifp);
static void
parse_irdp_packet(char *p,
struct zebra_if *zi;
struct irdp_interface *irdp;
char buf[IRDP_RX_BUF];
- int ret, ifindex;
+ int ret, ifindex = 0;
int irdp_sock = THREAD_FD (r);
t_irdp_raw = thread_add_read (zebrad.master, irdp_read_raw, NULL, irdp_sock);