diff options
author | ajs <ajs> | 2005-03-30 18:33:13 +0200 |
---|---|---|
committer | ajs <ajs> | 2005-03-30 18:33:13 +0200 |
commit | 2da40f4919f6268d4935c42a358739ffdf3a48dc (patch) | |
tree | aa40f9570647e8631ed5d74371f9c11bec25a98f /zebra/irdp_packet.c | |
parent | 2005-03-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu> (diff) | |
download | frr-2da40f4919f6268d4935c42a358739ffdf3a48dc.tar.xz frr-2da40f4919f6268d4935c42a358739ffdf3a48dc.zip |
2005-03-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* irdp.h: Add prototype for irdp_sock_init, and fix protos for
other irdp_* functions.
* irdp_interface.c: (irdp_if_start) If irdp_sock is negative,
call irdp_sock_init to create the IRDP socket.
(irdp_if_init) Rename to irdp_init().
(get_iflist_ifp) Remove function that is a duplicate of
if_lookup_by_index.
(*) Make many functions static. And remove superfluous "\n" from
several zlog messages.
* irdp_main.c: (irdp_init) Remove function that used to call
irdp_if_init() and irdp_sock_init(), since we will now create
the socket only upon first use.
(irdp_sock_init) Do not update global irdp_sock variable, just
return the fd and assume that the caller will do so. If setsockopt
calls fail, close the socket before returning -1.
(*) Make many functions static.
* irdp_packet.c: Initialize irdp_sock to -1.
(irdp_read_raw) Call standard library function if_lookup_by_index
instead of get_iflist_ifp.
(irdp_recvmsg) Should be static, not global.
Diffstat (limited to 'zebra/irdp_packet.c')
-rw-r--r-- | zebra/irdp_packet.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 2f448ecaf..74c75ab25 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -66,16 +66,16 @@ /* GLOBAL VARS */ -int irdp_sock; +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; -extern struct interface *get_iflist_ifp(int idx); int in_cksum (void *ptr, int nbytes); void process_solicit (struct interface *ifp); -void parse_irdp_packet(char *p, +static void +parse_irdp_packet(char *p, int len, struct interface *ifp) { @@ -187,7 +187,8 @@ void parse_irdp_packet(char *p, } } -int irdp_recvmsg (int sock, u_char *buf, int size, int *ifindex) +static int +irdp_recvmsg (int sock, u_char *buf, int size, int *ifindex) { struct msghdr msg; struct iovec iov; @@ -239,7 +240,7 @@ int irdp_read_raw(struct thread *r) if (ret < 0) zlog_warn ("IRDP: RX Error length = %d", ret); - ifp = get_iflist_ifp(ifindex); + ifp = if_lookup_by_index(ifindex); if(! ifp ) return ret; zi= ifp->info; |