[Olsr-cvs] olsrd-current/src/olsr_switch link_rules.c, 1.6, 1.7 link_rules.h, 1.4, 1.5 main.c, 1.33, 1.34 ohs_cmd.c, 1.25, 1.26 olsr_host_switch.h, 1.11, 1.12
Bernd Petrovitsch
(spam-protected)
Thu Nov 29 18:56:59 CET 2007
- Previous message: [Olsr-cvs] olsrd-current CHANGELOG,1.119,1.120
- Next message: [Olsr-cvs] olsrd-current/gui/linux-gtk/src callbacks.c, 1.3, 1.4 common.h, 1.4, 1.5 interface.c, 1.6, 1.7 interface.h, 1.3, 1.4 ipc.c, 1.5, 1.6 ipc.h, 1.3, 1.4 main.c, 1.4, 1.5 main.h, 1.2, 1.3 nodes.c, 1.2, 1.3 nodes.h, 1.2, 1.3 olsr.c, 1.2, 1.3 olsr_protocol.h, 1.2, 1.3 packet.c, 1.2, 1.3 packet.h, 1.3, 1.4 pixmaps.h, 1.2, 1.3 routes.c, 1.2, 1.3 routes.h, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/olsrd/olsrd-current/src/olsr_switch
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30499/src/olsr_switch
Modified Files:
link_rules.c link_rules.h main.c ohs_cmd.c olsr_host_switch.h
Log Message:
* killed the duplicated olsr_ip_to_string() functions
* using "ipcalc.h" and killed the COPY_IP()/COMP_IP() macros
Index: ohs_cmd.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/ohs_cmd.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** ohs_cmd.c 16 Nov 2007 19:12:55 -0000 1.25
--- ohs_cmd.c 29 Nov 2007 17:56:57 -0000 1.26
***************
*** 45,48 ****
--- 45,50 ----
#include "commands.h"
#include "link_rules.h"
+ #include "ipcalc.h"
+
#include <string.h>
#include <stdlib.h>
***************
*** 247,386 ****
args += get_next_token(args, tok_buf, TOK_BUF_SIZE);
! if(!strlen(tok_buf))
goto print_usage;
! if(!strncmp(tok_buf, "bi", strlen("bi")))
! {
! bi = 1;
! args += get_next_token(args, tok_buf, TOK_BUF_SIZE);
!
! if(!strlen(tok_buf))
! goto print_usage;
}
! if(tok_buf[0] == '*')
! {
! wildc_src = 1;
! src = ohs_conns;
}
- else
- {
- if(!inet_aton(tok_buf, &iaddr))
- {
- printf("Invalid src IP %s\n", tok_buf);
- return -1;
- }
! src = get_client_by_addr((union olsr_ip_addr *)&iaddr.s_addr);
! if(!src)
! {
! printf("No such client: %s!\n", tok_buf);
! return -1;
! }
}
args += get_next_token(args, tok_buf, TOK_BUF_SIZE);
! if(!strlen(tok_buf))
goto print_usage;
! if(tok_buf[0] == '*')
! {
! wildc_dst = 1;
! dst = ohs_conns;
}
- else
- {
! if(!inet_aton(tok_buf, &iaddr))
! {
! printf("Invalid src IP %s\n", tok_buf);
! return -1;
! }
!
! dst = get_client_by_addr((union olsr_ip_addr *)&iaddr.s_addr);
! if(!dst)
! {
! printf("No such client: %s!\n", tok_buf);
! return -1;
! }
}
args += get_next_token(args, tok_buf, TOK_BUF_SIZE);
! if(!strlen(tok_buf))
goto print_usage;
/* No use for bi if both src and dst are widcards */
! if(wildc_src && wildc_dst)
! {
! bi = 0;
! }
qual = atoi(tok_buf);
! if(qual < 0 || qual > 100)
! {
! printf("Link quality out of range(0-100)\n");
! return -1;
! }
!
! while(src)
! {
!
! while(dst)
! {
! if(src == dst)
! goto next_iteration;
! link = get_link(src, &dst->ip_addr);
!
! inv_link = bi ? get_link(dst, &src->ip_addr) : NULL;
!
! if(qual == 100)
! {
! /* Remove link entry */
! if(link)
! remove_link(src, link);
! if(inv_link)
! remove_link(dst, inv_link);
! }
! else
! {
! if(!link)
! {
! /* Create new link */
! link = add_link(src, dst);
! }
! link->quality = qual;
! if(bi)
! {
! if(!inv_link)
! {
! /* Create new link */
! inv_link = add_link(dst, src);
! }
! inv_link->quality = qual;
! }
! }
!
! printf("%s %sdirectional link(s) %s %c=> %s quality %d\n",
! (qual == 100) ? "Removing" : "Setting", bi ? "bi" : "uni",
! olsr_ip_to_string(&src->ip_addr), bi ? '<' : '=',
! olsr_ip_to_string(&dst->ip_addr), qual);
!
! next_iteration:
! if(wildc_dst)
dst = dst->next;
! else
break;
! }
! dst = wildc_dst ? ohs_conns : dst;
! src = wildc_src ? src->next : NULL;
}
return 1;
--- 249,369 ----
args += get_next_token(args, tok_buf, TOK_BUF_SIZE);
! if (!strlen(tok_buf)) {
goto print_usage;
+ }
+ if(!strncmp(tok_buf, "bi", strlen("bi"))) {
+ bi = 1;
+ args += get_next_token(args, tok_buf, TOK_BUF_SIZE);
! if (!strlen(tok_buf)) {
! goto print_usage;
}
+ }
! if(tok_buf[0] == '*') {
! wildc_src = 1;
! src = ohs_conns;
! } else {
! if (!inet_aton(tok_buf, &iaddr)) {
! printf("Invalid src IP %s\n", tok_buf);
! return -1;
}
! src = get_client_by_addr((union olsr_ip_addr *)&iaddr.s_addr);
! if (!src) {
! printf("No such client: %s!\n", tok_buf);
! return -1;
}
+ }
args += get_next_token(args, tok_buf, TOK_BUF_SIZE);
! if (!strlen(tok_buf)) {
goto print_usage;
+ }
! if(tok_buf[0] == '*') {
! wildc_dst = 1;
! dst = ohs_conns;
! } else {
! if(!inet_aton(tok_buf, &iaddr)) {
! printf("Invalid src IP %s\n", tok_buf);
! return -1;
}
! dst = get_client_by_addr((union olsr_ip_addr *)&iaddr.s_addr);
! if (!dst) {
! printf("No such client: %s!\n", tok_buf);
! return -1;
}
+ }
args += get_next_token(args, tok_buf, TOK_BUF_SIZE);
! if (!strlen(tok_buf)) {
goto print_usage;
+ }
/* No use for bi if both src and dst are widcards */
! if (wildc_src && wildc_dst) {
! bi = 0;
! }
qual = atoi(tok_buf);
! if(qual < 0 || qual > 100) {
! printf("Link quality out of range(0-100)\n");
! return -1;
! }
! while (src) {
! while (dst) {
! struct ipaddr_str srcaddrstr, dstaddrstr;
! if(src != dst) {
! link = get_link(src, &dst->ip_addr);
! inv_link = bi ? get_link(dst, &src->ip_addr) : NULL;
! if(qual == 100) {
! /* Remove link entry */
! if (link) {
! remove_link(src, link);
! }
! if (inv_link) {
! remove_link(dst, inv_link);
! }
! } else {
! if (!link) {
! /* Create new link */
! link = add_link(src, dst);
! }
! link->quality = qual;
! if (bi) {
! if(!inv_link) {
! /* Create new link */
! inv_link = add_link(dst, src);
! }
! inv_link->quality = qual;
! }
! }
! printf("%s %sdirectional link(s) %s %c=> %s quality %d\n",
! (qual == 100) ? "Removing" : "Setting",
! bi ? "bi" : "uni",
! olsr_ip_to_string(&srcaddrstr, &src->ip_addr),
! bi ? '<' : '=',
! olsr_ip_to_string(&dstaddrstr, &dst->ip_addr),
! qual);
! }
! if (wildc_dst) {
dst = dst->next;
! } else {
break;
! }
}
+ dst = wildc_dst ? ohs_conns : dst;
+ src = wildc_src ? src->next : NULL;
+ }
return 1;
***************
*** 398,439 ****
if(!strlen(tok_buf) ||
! !strncmp(tok_buf, "clients", strlen("clients")))
! {
! printf("All connected clients:\n");
!
! while(oc)
! {
! printf("\t%s - Rx: %d Tx: %d LinkCnt: %d\n", olsr_ip_to_string(&oc->ip_addr),
! oc->rx, oc->tx, oc->linkcnt);
! oc = oc->next;
! }
! }
! else if(!strncmp(tok_buf, "links", strlen("links")))
! {
! printf("All configured links:\n");
! while(oc)
! {
! struct ohs_ip_link *links = oc->links;
!
! while(links)
! {
! printf("\t%s => %s Quality: %d\n",
! olsr_ip_to_string(&oc->ip_addr),
! olsr_ip_to_string(&links->dst),
! links->quality);
!
! links = links->next;
! }
! oc = oc->next;
! }
}
! else
! {
! printf("list [clients|links]");
! return -1;
}
!
return 1;
}
--- 381,416 ----
if(!strlen(tok_buf) ||
! !strncmp(tok_buf, "clients", strlen("clients"))) {
! printf("All connected clients:\n");
! while(oc) {
! struct ipaddr_str addrstr;
! printf("\t%s - Rx: %d Tx: %d LinkCnt: %d\n",
! olsr_ip_to_string(&addrstr, &oc->ip_addr),
! oc->rx,
! oc->tx,
! oc->linkcnt);
! oc = oc->next;
}
! }
! else if(!strncmp(tok_buf, "links", strlen("links"))) {
! printf("All configured links:\n");
! while (oc) {
! struct ohs_ip_link *links = oc->links;
! while (links) {
! struct ipaddr_str addrstr, dststr;
! printf("\t%s => %s Quality: %d\n",
! olsr_ip_to_string(&addrstr, &oc->ip_addr),
! olsr_ip_to_string(&dststr, &links->dst),
! links->quality);
! links = links->next;
! }
! oc = oc->next;
}
! } else {
! printf("list [clients|links]");
! return -1;
! }
return 1;
}
Index: olsr_host_switch.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/olsr_host_switch.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** olsr_host_switch.h 8 Nov 2007 22:47:42 -0000 1.11
--- olsr_host_switch.h 29 Nov 2007 17:56:57 -0000 1.12
***************
*** 51,60 ****
#define OHS_DEFAULT_OLSRD_PATH "./olsrd"
! #define OHS_OUT_OF_MEMORY(s) \
! { printf("ohsd: out of memory \"%s\"!\n", s); ohs_close(0);}
!
! #define COMP_IP(ip1, ip2) (!memcmp(ip1, ip2, ipsize))
!
! #define COPY_IP(to, from) memcpy(to, from, ipsize)
#ifdef WIN32
--- 51,55 ----
#define OHS_DEFAULT_OLSRD_PATH "./olsrd"
! #define OHS_OUT_OF_MEMORY(s) do { printf("ohsd: out of memory \"%s\"!\n", s); ohs_close(0); } while (0)
#ifdef WIN32
***************
*** 83,88 ****
};
- extern int ipsize;
-
extern olsr_u32_t logbits;
--- 78,81 ----
***************
*** 102,108 ****
#endif
- const char *
- olsr_ip_to_string(const union olsr_ip_addr *);
-
struct ohs_connection *
get_client_by_addr(const union olsr_ip_addr *);
--- 95,98 ----
Index: main.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/main.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** main.c 29 Nov 2007 17:07:15 -0000 1.33
--- main.c 29 Nov 2007 17:56:57 -0000 1.34
***************
*** 46,49 ****
--- 46,51 ----
#include "link_rules.h"
#include "ohs_cmd.h"
+ #include "ipcalc.h"
+
#include <sys/types.h>
#include <sys/socket.h>
***************
*** 75,80 ****
struct ohs_connection *ohs_conns;
! static int ip_version;
! int ipsize;
olsr_u32_t logbits;
--- 77,84 ----
struct ohs_connection *ohs_conns;
! //static int ip_version;
! //int ipsize;
! static struct olsrd_config olsr_cnf_data;
! struct olsrd_config *olsr_cnf = &olsr_cnf_data;
olsr_u32_t logbits;
***************
*** 101,118 ****
#endif
- const char *
- olsr_ip_to_string(const union olsr_ip_addr *addr)
- {
- static char buff[4][100];
- static int index = 0;
- const char *ret = inet_ntop(ip_version,
- ip_version == AF_INET ? (const void *)&addr->v4 : (const void *)&addr->v6,
- buff[index],
- sizeof(buff[index]));
- index = (index + 1) & 3;
- return ret;
- }
-
-
#ifdef WIN32
int __stdcall
--- 105,108 ----
***************
*** 133,144 ****
get_client_by_addr(const union olsr_ip_addr *adr)
{
! struct ohs_connection *oc = ohs_conns;
!
! while(oc)
! {
! if(COMP_IP(adr, &oc->ip_addr))
return oc;
- oc = oc->next;
}
return NULL;
}
--- 123,132 ----
get_client_by_addr(const union olsr_ip_addr *adr)
{
! struct ohs_connection *oc;
! for (oc = ohs_conns; oc != NULL; oc = oc->next) {
! if (ipequal(adr, &oc->ip_addr)) {
return oc;
}
+ }
return NULL;
}
***************
*** 149,167 ****
{
struct ohs_connection *oc;
- olsr_u32_t new_addr;
int i;
! if(logbits & LOG_CONNECT)
printf("ohs_init_new_connection\n");
!
/* Create new client node */
! oc = malloc(sizeof(struct ohs_connection));
! if(!oc)
OHS_OUT_OF_MEMORY("New connection");
!
! memset(oc, 0, sizeof(oc));
oc->socket = s;
-
oc->links = NULL;
oc->rx = 0;
--- 137,152 ----
{
struct ohs_connection *oc;
int i;
! if(logbits & LOG_CONNECT) {
printf("ohs_init_new_connection\n");
! }
/* Create new client node */
! oc = calloc(1, sizeof(struct ohs_connection));
! if (!oc) {
OHS_OUT_OF_MEMORY("New connection");
! }
oc->socket = s;
oc->links = NULL;
oc->rx = 0;
***************
*** 174,183 ****
/* Get "fake IP" */
! for (i = 0; i < 20; i++)
! {
/* Win32 needs that cast. */
! if (recv(oc->socket, (void *)&new_addr, sizeof(new_addr), 0) == 4)
break;
!
#if defined WIN32
Sleep(100);
--- 159,167 ----
/* Get "fake IP" */
! for (i = 0; i < 20; i++) {
/* Win32 needs that cast. */
! if (recv(oc->socket, (void *)&oc->ip_addr, olsr_cnf->ipsize, 0) == (int)olsr_cnf->ipsize) {
break;
! }
#if defined WIN32
Sleep(100);
***************
*** 185,211 ****
}
! if (i == 20)
! {
printf("Failed to fetch IP address! (%s)\n", strerror(errno));
return -1;
}
! oc->ip_addr.v4.s_addr = ntohl(new_addr);
! if(logbits & LOG_CONNECT)
! printf("IP: %s\n", olsr_ip_to_string(&oc->ip_addr));
!
! if(get_client_by_addr(&oc->ip_addr))
! {
! if(logbits & LOG_CONNECT)
! printf("IP: %s DUPLICATE! Disconecting client!\n", olsr_ip_to_string(&oc->ip_addr));
!
! close(s);
! return -1;
}
/* Queue */
oc->next = ohs_conns;
ohs_conns = oc;
-
return 1;
}
--- 169,194 ----
}
! if (i == 20) {
printf("Failed to fetch IP address! (%s)\n", strerror(errno));
return -1;
}
! if (logbits & LOG_CONNECT) {
! struct ipaddr_str addrstr;
! printf("IP: %s\n", olsr_ip_to_string(&addrstr, &oc->ip_addr));
! }
! if (get_client_by_addr(&oc->ip_addr)) {
! if (logbits & LOG_CONNECT) {
! struct ipaddr_str addrstr;
! printf("IP: %s DUPLICATE! Disconecting client!\n", olsr_ip_to_string(&addrstr, &oc->ip_addr));
}
+ close(s);
+ free(oc);
+ return -1;
+ }
/* Queue */
oc->next = ohs_conns;
ohs_conns = oc;
return 1;
}
***************
*** 214,253 ****
ohs_delete_connection(struct ohs_connection *oc)
{
!
! if(!oc)
return -1;
!
/* Close the socket */
close(oc->socket);
! if(logbits & LOG_CONNECT)
! printf("Removing entry %s\n", olsr_ip_to_string(&oc->ip_addr));
/* De-queue */
! if(oc == ohs_conns)
! {
! ohs_conns = ohs_conns->next;
! }
! else
! {
! struct ohs_connection *curr_entry, *prev_entry;
! curr_entry = ohs_conns->next;
! prev_entry = ohs_conns;
! while(curr_entry)
! {
! if(curr_entry == oc)
! {
! prev_entry->next = curr_entry->next;
! break;
! }
! prev_entry = curr_entry;
! curr_entry = curr_entry->next;
! }
}
!
ohs_delete_all_related_links(oc);
- /* Free */
- free(oc);
return 0;
}
--- 197,229 ----
ohs_delete_connection(struct ohs_connection *oc)
{
! if (!oc) {
return -1;
! }
/* Close the socket */
close(oc->socket);
! if(logbits & LOG_CONNECT) {
! struct ipaddr_str addrstr;
! printf("Removing entry %s\n", olsr_ip_to_string(&addrstr, &oc->ip_addr));
! }
/* De-queue */
! if(oc == ohs_conns) {
! ohs_conns = ohs_conns->next;
! } else {
! struct ohs_connection *curr_entry = ohs_conns->next;
! struct ohs_connection *prev_entry = ohs_conns;
! while (curr_entry != NULL) {
! if(curr_entry == oc) {
! prev_entry->next = curr_entry->next;
! break;
! }
! prev_entry = curr_entry;
! curr_entry = curr_entry->next;
}
! }
ohs_delete_all_related_links(oc);
+ free(oc);
return 0;
}
***************
*** 265,300 ****
return -1;
! if(logbits & LOG_FORWARD)
! printf("Received %ld bytes from %s\n", (long)len, olsr_ip_to_string(&oc->ip_addr));
!
/* Loop trough clients */
! for(ohs_cs = ohs_conns; ohs_cs; ohs_cs = ohs_cs->next)
! {
! /* Check that the link is active open */
! if(ohs_check_link(oc, &ohs_cs->ip_addr) &&
! oc->socket != ohs_cs->socket)
! {
! ssize_t sent;
! /* Send link addr */
! if(send(ohs_cs->socket, oc->ip_addr.v6.s6_addr, ipsize, 0) != ipsize)
! {
! printf("Error sending link address!\n");
! }
! /* Send data */
! if(logbits & LOG_FORWARD)
! printf("Sending %d bytes %s=>%s\n", (int)len,
! olsr_ip_to_string(&oc->ip_addr),
! olsr_ip_to_string(&ohs_cs->ip_addr));
! if((sent = send(ohs_cs->socket, data_buffer, len, 0)) != len)
! {
! printf("Error sending(buf %d != sent %d)\n", (int)len, (int)sent);
! }
! ohs_cs->rx++;
! cnt++;
! }
}
!
return cnt;
}
--- 241,276 ----
return -1;
! if(logbits & LOG_FORWARD) {
! struct ipaddr_str addrstr;
! printf("Received %ld bytes from %s\n", (long)len, olsr_ip_to_string(&addrstr, &oc->ip_addr));
! }
/* Loop trough clients */
! for(ohs_cs = ohs_conns; ohs_cs; ohs_cs = ohs_cs->next) {
! /* Check that the link is active open */
! if(ohs_check_link(oc, &ohs_cs->ip_addr) &&
! oc->socket != ohs_cs->socket) {
! ssize_t sent;
! /* Send link addr */
! if (send(ohs_cs->socket, (const void *)&oc->ip_addr, olsr_cnf->ipsize, 0) != (int)olsr_cnf->ipsize) {
! printf("Error sending link address!\n");
! }
! /* Send data */
! if (logbits & LOG_FORWARD) {
! struct ipaddr_str addrstr, addrstr2;
! printf("Sending %d bytes %s=>%s\n",
! (int)len,
! olsr_ip_to_string(&addrstr, &oc->ip_addr),
! olsr_ip_to_string(&addrstr2, &ohs_cs->ip_addr));
! }
! sent = send(ohs_cs->socket, data_buffer, len, 0);
! if(sent != len) {
! printf("Error sending(buf %d != sent %d)\n", (int)len, (int)sent);
! }
! ohs_cs->rx++;
! cnt++;
}
! }
return cnt;
}
***************
*** 549,554 ****
logbits = LOG_DEFAULT;
! ip_version = AF_INET;
! ipsize = sizeof(struct in_addr);
srand((unsigned int)time(NULL));
--- 525,530 ----
logbits = LOG_DEFAULT;
! olsr_cnf->ip_version = AF_INET;
! olsr_cnf->ipsize = sizeof(struct in_addr);
srand((unsigned int)time(NULL));
Index: link_rules.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/link_rules.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** link_rules.c 3 Jun 2005 06:12:23 -0000 1.6
--- link_rules.c 29 Nov 2007 17:56:57 -0000 1.7
***************
*** 1,5 ****
/*
* The olsr.org Optimized Link-State Routing daemon(olsrd)
! * Copyright (c) 2005, Andreas Tønnesen((spam-protected))
* All rights reserved.
*
--- 1,5 ----
/*
* The olsr.org Optimized Link-State Routing daemon(olsrd)
! * Copyright (c) 2005, Andreas Tønnesen((spam-protected))
* All rights reserved.
*
***************
*** 42,45 ****
--- 42,47 ----
#include "link_rules.h"
#include "olsr_host_switch.h"
+ #include "ipcalc.h"
+
#include <string.h>
#include <stdlib.h>
***************
*** 49,89 ****
ohs_check_link(struct ohs_connection *oc, union olsr_ip_addr *dst)
{
! struct ohs_ip_link *links = oc->links;
!
! while(links)
! {
! if(COMP_IP(&links->dst, dst))
! {
! int r;
!
! if(links->quality == 0)
! {
! if(logbits & LOG_LINK)
! printf("%s -> %s Q: %d\n",
! olsr_ip_to_string(&oc->ip_addr),
! olsr_ip_to_string(dst),
! links->quality);
!
! return 0;
! }
!
! r = 1 + (int)((100.0*rand())/(RAND_MAX + 1.0));
!
! if(logbits & LOG_LINK)
! printf("%s -> %s Q: %d R: %d\n",
! olsr_ip_to_string(&oc->ip_addr),
! olsr_ip_to_string(dst),
! links->quality, r);
! /* Random - based on quality */
! if(links->quality > r)
! return 0;
! else
! return 1;
! }
! links = links->next;
}
!
return 1;
}
--- 51,81 ----
ohs_check_link(struct ohs_connection *oc, union olsr_ip_addr *dst)
{
! struct ohs_ip_link *links;
! for (links = oc->links; links != NULL; links = links->next) {
! int r;
! if (!ipequal(&links->dst, dst)) {
! continue;
! }
! if (links->quality == 0) {
! if (logbits & LOG_LINK) {
! struct ipaddr_str addrstr, dststr;
! printf("%s -> %s Q: %d\n",
! olsr_ip_to_string(&addrstr, &oc->ip_addr),
! olsr_ip_to_string(&dststr, dst),
! links->quality);
! }
! return 0;
! }
! r = 1 + (int)(100.0 / (RAND_MAX + 1.0) * rand());
! if (logbits & LOG_LINK) {
! struct ipaddr_str addrstr, dststr;
! printf("%s -> %s Q: %d R: %d\n", olsr_ip_to_string(&addrstr, &oc->ip_addr),
! olsr_ip_to_string(&dststr, dst), links->quality, r);
}
! /* Random - based on quality */
! return links->quality > r ? 0 : 1;
! }
return 1;
}
***************
*** 123,127 ****
link->next = src->links;
src->links = link;
! COPY_IP(&link->dst, &dst->ip_addr);
src->linkcnt++;
--- 115,119 ----
link->next = src->links;
src->links = link;
! link->dst = dst->ip_addr;
src->linkcnt++;
***************
*** 158,173 ****
get_link(struct ohs_connection *oc, union olsr_ip_addr *dst)
{
! struct ohs_ip_link *links = oc->links;
!
! while(links)
! {
! if(COMP_IP(&links->dst, dst))
! {
! return links;
! }
!
! links = links->next;
}
!
return NULL;
}
--- 150,159 ----
get_link(struct ohs_connection *oc, union olsr_ip_addr *dst)
{
! struct ohs_ip_link *links;
! for (links = oc->links; links != NULL; links = links->next) {
! if (ipequal(&links->dst, dst)) {
! return links;
}
! }
return NULL;
}
Index: link_rules.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/link_rules.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** link_rules.h 3 Jun 2005 06:12:23 -0000 1.4
--- link_rules.h 29 Nov 2007 17:56:57 -0000 1.5
***************
*** 1,5 ****
/*
* The olsr.org Optimized Link-State Routing daemon(olsrd)
! * Copyright (c) 2005, Andreas Tønnesen((spam-protected))
* All rights reserved.
*
--- 1,5 ----
/*
* The olsr.org Optimized Link-State Routing daemon(olsrd)
! * Copyright (c) 2005, Andreas Tønnesen((spam-protected))
* All rights reserved.
*
- Previous message: [Olsr-cvs] olsrd-current CHANGELOG,1.119,1.120
- Next message: [Olsr-cvs] olsrd-current/gui/linux-gtk/src callbacks.c, 1.3, 1.4 common.h, 1.4, 1.5 interface.c, 1.6, 1.7 interface.h, 1.3, 1.4 ipc.c, 1.5, 1.6 ipc.h, 1.3, 1.4 main.c, 1.4, 1.5 main.h, 1.2, 1.3 nodes.c, 1.2, 1.3 nodes.h, 1.2, 1.3 olsr.c, 1.2, 1.3 olsr_protocol.h, 1.2, 1.3 packet.c, 1.2, 1.3 packet.h, 1.3, 1.4 pixmaps.h, 1.2, 1.3 routes.c, 1.2, 1.3 routes.h, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Olsr-cvs
mailing list