mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 04:26:12 +00:00
zebra: deal with irdp compile warnings
* zebra/irdp.h * irdp_send_thread(): move prototype to common header file * irdp_advert_off(): idem * process_solicit(): idem * irdp_read_raw(): idem * send_packet(): idem * zebra/irdp_interface.c * inet_2a(): move function to where it is used * in_cksum(): lib/checksum.h already provides prototype * irdp_send_thread(): prototype moved away * inet_2a(): idem * irdp_advert_off(): idem * b1, b2, b3, b4: get rid of global buffers for inet_2a() * if_group(): add local buffer for inet_2a() * if_add_group(): idem * if_drop_group(): idem * irdp_config_write(): idem * Adv_new(): make static * zebra/irdp_main.c * irdp_read_raw(): prototype moved away * send_packet(): idem * in_cksum(): lib/checksum.h already provides prototype * inet_2a(): function moved to irdp_interface.c * zebra/irdp_packet.c * b1, b2, b3, b4: get rid of global buffers for inet_2a() * in_cksum(): lib/checksum.h already provides prototype * process_solicit(): prototype moved away * irdp_read_raw(): fix uninitialized variable
This commit is contained in:
parent
9e4ca89c36
commit
ab0f615526
@ -146,5 +146,12 @@ extern void irdp_init(void);
|
|||||||
extern int irdp_sock_init(void);
|
extern int irdp_sock_init(void);
|
||||||
extern void irdp_finish(void);
|
extern void irdp_finish(void);
|
||||||
extern void irdp_config_write (struct vty *, struct interface *);
|
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 */
|
#endif /* _IRDP_H */
|
||||||
|
@ -65,14 +65,19 @@
|
|||||||
/* Master of threads. */
|
/* Master of threads. */
|
||||||
extern struct zebra_t zebrad;
|
extern struct zebra_t zebrad;
|
||||||
|
|
||||||
int in_cksum (void *ptr, int nbytes);
|
|
||||||
extern int irdp_sock;
|
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 *
|
static struct prefix *
|
||||||
irdp_get_prefix(struct interface *ifp)
|
irdp_get_prefix(struct interface *ifp)
|
||||||
@ -98,6 +103,7 @@ if_group (struct interface *ifp,
|
|||||||
struct ip_mreq m;
|
struct ip_mreq m;
|
||||||
struct prefix *p;
|
struct prefix *p;
|
||||||
int ret;
|
int ret;
|
||||||
|
char b1[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
zi = ifp->info;
|
zi = ifp->info;
|
||||||
|
|
||||||
@ -117,8 +123,8 @@ if_group (struct interface *ifp,
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
zlog_warn ("IRDP: %s can't setsockopt %s: %s",
|
zlog_warn ("IRDP: %s can't setsockopt %s: %s",
|
||||||
add_leave == IP_ADD_MEMBERSHIP? "join group":"leave group",
|
add_leave == IP_ADD_MEMBERSHIP? "join group":"leave group",
|
||||||
inet_2a(group, b1),
|
inet_2a(group, b1),
|
||||||
safe_strerror (errno));
|
safe_strerror (errno));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -129,6 +135,7 @@ if_add_group (struct interface *ifp)
|
|||||||
struct zebra_if *zi= ifp->info;
|
struct zebra_if *zi= ifp->info;
|
||||||
struct irdp_interface *irdp = &zi->irdp;
|
struct irdp_interface *irdp = &zi->irdp;
|
||||||
int ret;
|
int ret;
|
||||||
|
char b1[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
ret = if_group (ifp, irdp_sock, INADDR_ALLRTRS_GROUP, IP_ADD_MEMBERSHIP);
|
ret = if_group (ifp, irdp_sock, INADDR_ALLRTRS_GROUP, IP_ADD_MEMBERSHIP);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -148,6 +155,7 @@ if_drop_group (struct interface *ifp)
|
|||||||
struct zebra_if *zi= ifp->info;
|
struct zebra_if *zi= ifp->info;
|
||||||
struct irdp_interface *irdp = &zi->irdp;
|
struct irdp_interface *irdp = &zi->irdp;
|
||||||
int ret;
|
int ret;
|
||||||
|
char b1[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
ret = if_group (ifp, irdp_sock, INADDR_ALLRTRS_GROUP, IP_DROP_MEMBERSHIP);
|
ret = if_group (ifp, irdp_sock, INADDR_ALLRTRS_GROUP, IP_DROP_MEMBERSHIP);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -173,7 +181,7 @@ if_set_defaults(struct interface *ifp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct Adv *Adv_new (void)
|
static struct Adv *Adv_new (void)
|
||||||
{
|
{
|
||||||
return XCALLOC (MTYPE_TMP, sizeof (struct Adv));
|
return XCALLOC (MTYPE_TMP, sizeof (struct Adv));
|
||||||
}
|
}
|
||||||
@ -338,6 +346,7 @@ void irdp_config_write (struct vty *vty, struct interface *ifp)
|
|||||||
struct irdp_interface *irdp=&zi->irdp;
|
struct irdp_interface *irdp=&zi->irdp;
|
||||||
struct Adv *adv;
|
struct Adv *adv;
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
|
char b1[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
if(irdp->flags & IF_ACTIVE || irdp->flags & IF_SHUTDOWN) {
|
if(irdp->flags & IF_ACTIVE || irdp->flags & IF_SHUTDOWN) {
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
#include "zebra/irdp.h"
|
#include "zebra/irdp.h"
|
||||||
#include <netinet/ip_icmp.h>
|
#include <netinet/ip_icmp.h>
|
||||||
|
|
||||||
|
#include "checksum.h"
|
||||||
#include "if.h"
|
#include "if.h"
|
||||||
#include "sockunion.h"
|
#include "sockunion.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@ -75,25 +76,6 @@ struct thread *t_irdp_raw;
|
|||||||
/* Timer interval of irdp. */
|
/* Timer interval of irdp. */
|
||||||
int irdp_timer_interval = IRDP_DEFAULT_INTERVAL;
|
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
|
int
|
||||||
irdp_sock_init (void)
|
irdp_sock_init (void)
|
||||||
{
|
{
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include "zebra/irdp.h"
|
#include "zebra/irdp.h"
|
||||||
#include <netinet/ip_icmp.h>
|
#include <netinet/ip_icmp.h>
|
||||||
#include "if.h"
|
#include "if.h"
|
||||||
|
#include "checksum.h"
|
||||||
#include "sockunion.h"
|
#include "sockunion.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "sockopt.h"
|
#include "sockopt.h"
|
||||||
@ -67,12 +68,9 @@
|
|||||||
/* GLOBAL VARS */
|
/* GLOBAL VARS */
|
||||||
|
|
||||||
int irdp_sock = -1;
|
int irdp_sock = -1;
|
||||||
char b1[16], b2[16], b3[16], b4[16]; /* For inet_2a */
|
|
||||||
|
|
||||||
extern struct zebra_t zebrad;
|
extern struct zebra_t zebrad;
|
||||||
extern struct thread *t_irdp_raw;
|
extern struct thread *t_irdp_raw;
|
||||||
int in_cksum (void *ptr, int nbytes);
|
|
||||||
void process_solicit (struct interface *ifp);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_irdp_packet(char *p,
|
parse_irdp_packet(char *p,
|
||||||
@ -231,7 +229,7 @@ int irdp_read_raw(struct thread *r)
|
|||||||
struct zebra_if *zi;
|
struct zebra_if *zi;
|
||||||
struct irdp_interface *irdp;
|
struct irdp_interface *irdp;
|
||||||
char buf[IRDP_RX_BUF];
|
char buf[IRDP_RX_BUF];
|
||||||
int ret, ifindex;
|
int ret, ifindex = 0;
|
||||||
|
|
||||||
int irdp_sock = THREAD_FD (r);
|
int irdp_sock = THREAD_FD (r);
|
||||||
t_irdp_raw = thread_add_read (zebrad.master, irdp_read_raw, NULL, irdp_sock);
|
t_irdp_raw = thread_add_read (zebrad.master, irdp_read_raw, NULL, irdp_sock);
|
||||||
|
Loading…
Reference in New Issue
Block a user