[Olsr-cvs] olsrd-current/src defs.c, 1.1, 1.1.2.1 defs.h, 1.50.2.2, 1.50.2.3 generate_msg.c, 1.23, 1.23.2.1 interfaces.h, 1.30.2.1, 1.30.2.2 lq_packet.c, 1.19, 1.19.2.1 net_olsr.c, 1.7, 1.7.2.1 net_olsr.h, 1.1, 1.1.2.1 olsr.c, 1.47, 1.47.2.1 scheduler.c, 1.33.2.1, 1.33.2.2
Bernd Petrovitsch
(spam-protected)
Fri Nov 17 00:08:42 CET 2006
Update of /cvsroot/olsrd/olsrd-current/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16896
Modified Files:
Tag: olsrd_04
defs.c defs.h generate_msg.c interfaces.h lq_packet.c
net_olsr.c net_olsr.h olsr.c scheduler.c
Log Message:
* backported the deletion of MAX_IFS to the stable branch
Index: defs.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/Attic/defs.c,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -d -r1.1 -r1.1.2.1
*** defs.c 29 May 2005 12:47:45 -0000 1.1
--- defs.c 16 Nov 2006 23:08:39 -0000 1.1.2.1
***************
*** 37,42 ****
float max_tc_vtime;
- clock_t fwdtimer[MAX_IFS]; /* forwarding timer */
-
int minsize;
--- 37,40 ----
Index: net_olsr.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -d -r1.1 -r1.1.2.1
*** net_olsr.h 25 May 2005 20:59:46 -0000 1.1
--- net_olsr.h 16 Nov 2006 23:08:39 -0000 1.1.2.1
***************
*** 57,72 ****
- /* Output buffer structure */
-
- struct olsr_netbuf
- {
- char *buff; /* Pointer to the allocated buffer */
- int if_index;
- int bufsize; /* Size of the buffer */
- int maxsize; /* Max bytes of payload that can be added to the buffer */
- int pending; /* How much data is currently pending in the buffer */
- int reserved; /* Plugins can reserve space in buffers */
- };
-
void
init_net(void);
--- 57,60 ----
Index: defs.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/defs.h,v
retrieving revision 1.50.2.2
retrieving revision 1.50.2.3
diff -C2 -d -r1.50.2.2 -r1.50.2.3
*** defs.h 1 Nov 2006 09:21:44 -0000 1.50.2.2
--- defs.h 16 Nov 2006 23:08:39 -0000 1.50.2.3
***************
*** 72,76 ****
#define UDP_IPV4_HDRSIZE 28
#define UDP_IPV6_HDRSIZE 48
- #define MAX_IFS 16
/* Debug helper macro */
--- 72,75 ----
***************
*** 167,172 ****
extern float max_tc_vtime;
- extern clock_t fwdtimer[MAX_IFS]; /* forwarding timer */
-
extern int minsize;
--- 166,169 ----
Index: lq_packet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v
retrieving revision 1.19
retrieving revision 1.19.2.1
diff -C2 -d -r1.19 -r1.19.2.1
*** lq_packet.c 17 Nov 2005 01:58:51 -0000 1.19
--- lq_packet.c 16 Nov 2006 23:08:39 -0000 1.19.2.1
***************
*** 783,787 ****
destroy_lq_tc(&lq_tc);
! if(net_output_pending(outif) && TIMED_OUT(fwdtimer[outif->if_nr]))
set_buffer_timer(outif);
}
--- 783,787 ----
destroy_lq_tc(&lq_tc);
! if(net_output_pending(outif) && TIMED_OUT(outif->fwdtimer))
set_buffer_timer(outif);
}
Index: net_olsr.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** net_olsr.c 29 Dec 2005 18:37:16 -0000 1.7
--- net_olsr.c 16 Nov 2006 23:08:39 -0000 1.7.2.1
***************
*** 67,72 ****
static struct ptf *ptf_list;
- struct olsr_netbuf *netbufs[MAX_IFS];
-
static char ipv6_buf[100]; /* for address coversion */
--- 67,70 ----
***************
*** 140,161 ****
net_add_buffer(struct interface *ifp)
{
! struct olsr_netbuf *new_buf;
!
! /* If a buffer already exists for this interface back off */
! if(netbufs[ifp->if_nr])
! return -1;
!
! new_buf = olsr_malloc(sizeof(struct olsr_netbuf), "add_netbuff1");
! new_buf->buff = olsr_malloc(ifp->int_mtu, "add_netbuff2");
!
! /* Fill struct */
! new_buf->bufsize = ifp->int_mtu;
! new_buf->if_index = ifp->if_nr;
! new_buf->maxsize = ifp->int_mtu - OLSR_HEADERSIZE;
!
! new_buf->pending = 0;
! new_buf->reserved = 0;
! netbufs[ifp->if_nr] = new_buf;
return 0;
--- 138,159 ----
net_add_buffer(struct interface *ifp)
{
! /* Can the interfaces MTU actually change? If not, we can elimiate
! * the "bufsize" field in "struct olsr_netbuf".
! */
! if (ifp->netbuf.bufsize != ifp->int_mtu && ifp->netbuf.buff != NULL) {
! free(ifp->netbuf.buff);
! ifp->netbuf.buff = NULL;
! }
!
! if (ifp->netbuf.buff == NULL) {
! ifp->netbuf.buff = olsr_malloc(ifp->int_mtu, "add_netbuff");
! }
! /* Fill struct */
! ifp->netbuf.bufsize = ifp->int_mtu;
! ifp->netbuf.maxsize = ifp->int_mtu - OLSR_HEADERSIZE;
!
! ifp->netbuf.pending = 0;
! ifp->netbuf.reserved = 0;
return 0;
***************
*** 174,189 ****
net_remove_buffer(struct interface *ifp)
{
!
! /* If a buffer does no exist for this interface back off */
! if(!netbufs[ifp->if_nr])
! return -1;
!
! /* Flush pending data */
! if(netbufs[ifp->if_nr]->pending)
net_output(ifp);
! free(netbufs[ifp->if_nr]->buff);
! free(netbufs[ifp->if_nr]);
! netbufs[ifp->if_nr] = NULL;
return 0;
--- 172,180 ----
net_remove_buffer(struct interface *ifp)
{
! if(ifp->netbuf.pending)
net_output(ifp);
! free(ifp->netbuf.buff);
! ifp->netbuf.buff = NULL;
return 0;
***************
*** 209,217 ****
net_reserve_bufspace(struct interface *ifp, int size)
{
! if((!netbufs[ifp->if_nr]) || (size > netbufs[ifp->if_nr]->maxsize))
return -1;
! netbufs[ifp->if_nr]->reserved = size;
! netbufs[ifp->if_nr]->maxsize -= size;
return 0;
--- 200,208 ----
net_reserve_bufspace(struct interface *ifp, int size)
{
! if(size > ifp->netbuf.maxsize)
return -1;
! ifp->netbuf.reserved = size;
! ifp->netbuf.maxsize -= size;
return 0;
***************
*** 229,236 ****
net_output_pending(struct interface *ifp)
{
! if(!netbufs[ifp->if_nr])
! return -1;
!
! return netbufs[ifp->if_nr]->pending;
}
--- 220,224 ----
net_output_pending(struct interface *ifp)
{
! return ifp->netbuf.pending;
}
***************
*** 251,263 ****
net_outbuffer_push(struct interface *ifp, olsr_u8_t *data, olsr_u16_t size)
{
!
! if(!netbufs[ifp->if_nr])
! return -1;
!
! if((netbufs[ifp->if_nr]->pending + size) > netbufs[ifp->if_nr]->maxsize)
return 0;
!
! memcpy(&netbufs[ifp->if_nr]->buff[netbufs[ifp->if_nr]->pending + OLSR_HEADERSIZE], data, size);
! netbufs[ifp->if_nr]->pending += size;
return size;
--- 239,247 ----
net_outbuffer_push(struct interface *ifp, olsr_u8_t *data, olsr_u16_t size)
{
! if((ifp->netbuf.pending + size) > ifp->netbuf.maxsize)
return 0;
!
! memcpy(&ifp->netbuf.buff[ifp->netbuf.pending + OLSR_HEADERSIZE], data, size);
! ifp->netbuf.pending += size;
return size;
***************
*** 279,291 ****
net_outbuffer_push_reserved(struct interface *ifp, olsr_u8_t *data, olsr_u16_t size)
{
!
! if(!netbufs[ifp->if_nr])
! return -1;
!
! if((netbufs[ifp->if_nr]->pending + size) > (netbufs[ifp->if_nr]->maxsize + netbufs[ifp->if_nr]->reserved))
return 0;
!
! memcpy(&netbufs[ifp->if_nr]->buff[netbufs[ifp->if_nr]->pending + OLSR_HEADERSIZE], data, size);
! netbufs[ifp->if_nr]->pending += size;
return size;
--- 263,271 ----
net_outbuffer_push_reserved(struct interface *ifp, olsr_u8_t *data, olsr_u16_t size)
{
! if((ifp->netbuf.pending + size) > (ifp->netbuf.maxsize + ifp->netbuf.reserved))
return 0;
!
! memcpy(&ifp->netbuf.buff[ifp->netbuf.pending + OLSR_HEADERSIZE], data, size);
! ifp->netbuf.pending += size;
return size;
***************
*** 303,314 ****
net_outbuffer_bytes_left(struct interface *ifp)
{
! int remaining;
!
! if(!netbufs[ifp->if_nr])
! return 0;
!
! remaining = netbufs[ifp->if_nr]->maxsize - netbufs[ifp->if_nr]->pending;
!
! return remaining ? remaining : 0;
}
--- 283,287 ----
net_outbuffer_bytes_left(struct interface *ifp)
{
! return ifp->netbuf.maxsize - ifp->netbuf.pending;
}
***************
*** 400,416 ****
sin6 = NULL;
! if(!netbufs[ifp->if_nr])
! return -1;
!
! if(!netbufs[ifp->if_nr]->pending)
return 0;
! netbufs[ifp->if_nr]->pending += OLSR_HEADERSIZE;
!
! outmsg = (union olsr_packet *)netbufs[ifp->if_nr]->buff;
/* Add the Packet seqno */
outmsg->v4.olsr_seqno = htons(ifp->olsr_seqnum++);
/* Set the packetlength */
! outmsg->v4.olsr_packlen = htons(netbufs[ifp->if_nr]->pending);
if(olsr_cnf->ip_version == AF_INET)
--- 373,386 ----
sin6 = NULL;
! if(!ifp->netbuf.pending)
return 0;
! ifp->netbuf.pending += OLSR_HEADERSIZE;
!
! outmsg = (union olsr_packet *)ifp->netbuf.buff;
/* Add the Packet seqno */
outmsg->v4.olsr_seqno = htons(ifp->olsr_seqnum++);
/* Set the packetlength */
! outmsg->v4.olsr_packlen = htons(ifp->netbuf.pending);
if(olsr_cnf->ip_version == AF_INET)
***************
*** 441,445 ****
while(tmp_ptf_list != NULL)
{
! tmp_ptf_list->function(netbufs[ifp->if_nr]->buff, &netbufs[ifp->if_nr]->pending);
tmp_ptf_list = tmp_ptf_list->next;
}
--- 411,415 ----
while(tmp_ptf_list != NULL)
{
! tmp_ptf_list->function(ifp->netbuf.buff, &ifp->netbuf.pending);
tmp_ptf_list = tmp_ptf_list->next;
}
***************
*** 450,455 ****
*/
if(disp_pack_out)
! print_olsr_serialized_packet(stdout, (union olsr_packet *)netbufs[ifp->if_nr]->buff,
! netbufs[ifp->if_nr]->pending, &ifp->ip_addr);
if(olsr_cnf->ip_version == AF_INET)
--- 420,425 ----
*/
if(disp_pack_out)
! print_olsr_serialized_packet(stdout, (union olsr_packet *)ifp->netbuf.buff,
! ifp->netbuf.pending, &ifp->ip_addr);
if(olsr_cnf->ip_version == AF_INET)
***************
*** 457,462 ****
/* IP version 4 */
if(olsr_sendto(ifp->olsr_socket,
! netbufs[ifp->if_nr]->buff,
! netbufs[ifp->if_nr]->pending,
MSG_DONTROUTE,
(struct sockaddr *)sin,
--- 427,432 ----
/* IP version 4 */
if(olsr_sendto(ifp->olsr_socket,
! ifp->netbuf.buff,
! ifp->netbuf.pending,
MSG_DONTROUTE,
(struct sockaddr *)sin,
***************
*** 466,470 ****
perror("sendto(v4)");
olsr_syslog(OLSR_LOG_ERR, "OLSR: sendto IPv4 %m");
! netbufs[ifp->if_nr]->pending = 0;
return -1;
}
--- 436,440 ----
perror("sendto(v4)");
olsr_syslog(OLSR_LOG_ERR, "OLSR: sendto IPv4 %m");
! ifp->netbuf.pending = 0;
return -1;
}
***************
*** 474,479 ****
/* IP version 6 */
if(olsr_sendto(ifp->olsr_socket,
! netbufs[ifp->if_nr]->buff,
! netbufs[ifp->if_nr]->pending,
MSG_DONTROUTE,
(struct sockaddr *)sin6,
--- 444,449 ----
/* IP version 6 */
if(olsr_sendto(ifp->olsr_socket,
! ifp->netbuf.buff,
! ifp->netbuf.pending,
MSG_DONTROUTE,
(struct sockaddr *)sin6,
***************
*** 485,495 ****
fprintf(stderr, "Socket: %d interface: %d\n", ifp->olsr_socket, ifp->if_nr);
fprintf(stderr, "To: %s (size: %d)\n", ip6_to_string(&sin6->sin6_addr), (int)sizeof(*sin6));
! fprintf(stderr, "Outputsize: %d\n", netbufs[ifp->if_nr]->pending);
! netbufs[ifp->if_nr]->pending = 0;
return -1;
}
}
! netbufs[ifp->if_nr]->pending = 0;
// if we've just transmitted a TC message, let Dijkstra use the current
--- 455,465 ----
fprintf(stderr, "Socket: %d interface: %d\n", ifp->olsr_socket, ifp->if_nr);
fprintf(stderr, "To: %s (size: %d)\n", ip6_to_string(&sin6->sin6_addr), (int)sizeof(*sin6));
! fprintf(stderr, "Outputsize: %d\n", ifp->netbuf.pending);
! ifp->netbuf.pending = 0;
return -1;
}
}
! ifp->netbuf.pending = 0;
// if we've just transmitted a TC message, let Dijkstra use the current
Index: interfaces.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v
retrieving revision 1.30.2.1
retrieving revision 1.30.2.2
diff -C2 -d -r1.30.2.1 -r1.30.2.2
*** interfaces.h 17 Apr 2006 18:25:29 -0000 1.30.2.1
--- interfaces.h 16 Nov 2006 23:08:39 -0000 1.30.2.2
***************
*** 44,47 ****
--- 44,48 ----
#define _OLSR_INTERFACE
+ #include <sys/times.h>
#include <sys/types.h>
#include <sys/socket.h>
***************
*** 107,110 ****
--- 108,123 ----
};
+ /* Output buffer structure. This should actually be in net_olsr.h but we have circular references then.
+ */
+ struct olsr_netbuf
+ {
+ olsr_u8_t *buff;/* Pointer to the allocated buffer */
+ int bufsize; /* Size of the buffer */
+ int maxsize; /* Max bytes of payload that can be added to the buffer */
+ int pending; /* How much data is currently pending in the buffer */
+ int reserved; /* Plugins can reserve space in buffers */
+ };
+
+
/**
*A struct containing all necessary information about each
***************
*** 136,139 ****
--- 149,156 ----
struct vtimes valtimes;
+ clock_t fwdtimer; /* Timeout for OLSR forwarding on this if */
+
+ struct olsr_netbuf netbuf; /* the buffer to construct the packet data */
+
struct if_gen_property *gen_properties;/* Generic interface properties */
Index: generate_msg.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/generate_msg.c,v
retrieving revision 1.23
retrieving revision 1.23.2.1
diff -C2 -d -r1.23 -r1.23.2.1
*** generate_msg.c 27 Feb 2005 18:39:43 -0000 1.23
--- generate_msg.c 16 Nov 2006 23:08:39 -0000 1.23.2.1
***************
*** 87,91 ****
olsr_build_tc_packet(&tcpacket);
! if(queue_tc(&tcpacket, ifn) && TIMED_OUT(fwdtimer[ifn->if_nr]))
{
set_buffer_timer(ifn);
--- 87,91 ----
olsr_build_tc_packet(&tcpacket);
! if(queue_tc(&tcpacket, ifn) && TIMED_OUT(ifn->fwdtimer))
{
set_buffer_timer(ifn);
***************
*** 100,104 ****
struct interface *ifn = (struct interface *)p;
! if(queue_mid(ifn) && TIMED_OUT(fwdtimer[ifn->if_nr]))
{
set_buffer_timer(ifn);
--- 100,104 ----
struct interface *ifn = (struct interface *)p;
! if(queue_mid(ifn) && TIMED_OUT(ifn->fwdtimer))
{
set_buffer_timer(ifn);
***************
*** 114,118 ****
struct interface *ifn = (struct interface *)p;
! if(queue_hna(ifn) && TIMED_OUT(fwdtimer[ifn->if_nr]))
{
set_buffer_timer(ifn);
--- 114,118 ----
struct interface *ifn = (struct interface *)p;
! if(queue_hna(ifn) && TIMED_OUT(ifn->fwdtimer))
{
set_buffer_timer(ifn);
Index: scheduler.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/scheduler.c,v
retrieving revision 1.33.2.1
retrieving revision 1.33.2.2
diff -C2 -d -r1.33.2.1 -r1.33.2.2
*** scheduler.c 27 Jul 2006 15:57:47 -0000 1.33.2.1
--- scheduler.c 16 Nov 2006 23:08:39 -0000 1.33.2.2
***************
*** 198,202 ****
for (ifn = ifnet; ifn ; ifn = ifn->int_next)
{
! if(net_output_pending(ifn) && TIMED_OUT(fwdtimer[ifn->if_nr]))
net_output(ifn);
}
--- 198,202 ----
for (ifn = ifnet; ifn ; ifn = ifn->int_next)
{
! if(net_output_pending(ifn) && TIMED_OUT(ifn->fwdtimer))
net_output(ifn);
}
Index: olsr.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr.c,v
retrieving revision 1.47
retrieving revision 1.47.2.1
diff -C2 -d -r1.47 -r1.47.2.1
*** olsr.c 17 Nov 2005 04:25:44 -0000 1.47
--- olsr.c 16 Nov 2006 23:08:39 -0000 1.47.2.1
***************
*** 430,434 ****
jitter *= max_jitter;
! fwdtimer[ifn->if_nr] = GET_TIMESTAMP(jitter*1000);
}
--- 430,434 ----
jitter *= max_jitter;
! ifn->fwdtimer = GET_TIMESTAMP(jitter*1000);
}
More information about the Olsr-cvs
mailing list