Change ctimer startup order, add multihop to wpcap and minimal-net platform.
This commit is contained in:
parent
058bb6039b
commit
6ea7250af7
|
@ -609,6 +609,31 @@ wpcap_poll(void)
|
||||||
PRINTF("SIN: Discarding echoed packet\n");
|
PRINTF("SIN: Discarding echoed packet\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* To implement multihop, ignore packets to us from specified source macs
|
||||||
|
*/
|
||||||
|
// printf("ethtype=%x %x",*(packet+2*UIP_LLADDR_LEN),*(packet+2*UIP_LLADDR_LEN+1));
|
||||||
|
// printf("hopcount=%u",*(packet+21));
|
||||||
|
#if 0
|
||||||
|
if (0
|
||||||
|
// || (*(packet+11) ==0x1) //20 ignores router
|
||||||
|
// || (*(packet+11) ==0x10)
|
||||||
|
|| (*(packet+11) ==0x20) //router ignores 20
|
||||||
|
) {
|
||||||
|
printf("i%x",*(packet+11));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* If we are not the recipient, ignore packets from other RPL nodes */
|
||||||
|
if (0
|
||||||
|
|| (*(packet+5) !=0x1) //router
|
||||||
|
// || (*(packet+11) ==0x10)
|
||||||
|
// || (*(packet+11) ==0x20) //router ignores 20
|
||||||
|
) {
|
||||||
|
printf("r%x",*(packet+11));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* UIP_CONF_IPV6 */
|
#endif /* UIP_CONF_IPV6 */
|
||||||
|
|
||||||
if(packet_header->caplen > UIP_BUFSIZE) {
|
if(packet_header->caplen > UIP_BUFSIZE) {
|
||||||
|
@ -665,8 +690,7 @@ wfall_poll(void)
|
||||||
u8_t
|
u8_t
|
||||||
wpcap_send(uip_lladdr_t *lladdr)
|
wpcap_send(uip_lladdr_t *lladdr)
|
||||||
{
|
{
|
||||||
// if(lladdr == NULL) { //when fallback used this gets ptr to lladdr of all zeroes on forwarded packets
|
if(lladdr == NULL) {
|
||||||
if(1) {
|
|
||||||
/* the dest must be multicast*/
|
/* the dest must be multicast*/
|
||||||
(&BUF->dest)->addr[0] = 0x33;
|
(&BUF->dest)->addr[0] = 0x33;
|
||||||
(&BUF->dest)->addr[1] = 0x33;
|
(&BUF->dest)->addr[1] = 0x33;
|
||||||
|
@ -675,7 +699,17 @@ wpcap_send(uip_lladdr_t *lladdr)
|
||||||
(&BUF->dest)->addr[4] = IPBUF->destipaddr.u8[14];
|
(&BUF->dest)->addr[4] = IPBUF->destipaddr.u8[14];
|
||||||
(&BUF->dest)->addr[5] = IPBUF->destipaddr.u8[15];
|
(&BUF->dest)->addr[5] = IPBUF->destipaddr.u8[15];
|
||||||
} else {
|
} else {
|
||||||
memcpy(&BUF->dest, lladdr, UIP_LLADDR_LEN);
|
//when fallback used this gets ptr to lladdr of all zeroes on forwarded packets, turn them into multicast(?)
|
||||||
|
if ((lladdr->addr[0]==0)&&(lladdr->addr[1]==0)&&(lladdr->addr[2]==0)&&(lladdr->addr[3]==0)&&(lladdr->addr[4]==0)&&(lladdr->addr[5]==0)) {
|
||||||
|
(&BUF->dest)->addr[0] = 0x33;
|
||||||
|
(&BUF->dest)->addr[1] = 0x33;
|
||||||
|
(&BUF->dest)->addr[2] = IPBUF->destipaddr.u8[12];
|
||||||
|
(&BUF->dest)->addr[3] = IPBUF->destipaddr.u8[13];
|
||||||
|
(&BUF->dest)->addr[4] = IPBUF->destipaddr.u8[14];
|
||||||
|
(&BUF->dest)->addr[5] = IPBUF->destipaddr.u8[15];
|
||||||
|
} else {
|
||||||
|
memcpy(&BUF->dest, lladdr, UIP_LLADDR_LEN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
memcpy(&BUF->src, &uip_lladdr, UIP_LLADDR_LEN);
|
memcpy(&BUF->src, &uip_lladdr, UIP_LLADDR_LEN);
|
||||||
PRINTF("SUT: %u\n", uip_len);
|
PRINTF("SUT: %u\n", uip_len);
|
||||||
|
|
|
@ -73,6 +73,15 @@ typedef unsigned short uip_stats_t;
|
||||||
//#define HARD_CODED_ADDRESS "fdfd::" //assign prefix; address becomes fdfd::206:98ff:fe00:232
|
//#define HARD_CODED_ADDRESS "fdfd::" //assign prefix; address becomes fdfd::206:98ff:fe00:232
|
||||||
//#define HARD_CODED_ADDRESS "fdfd::10" //assign prefix and ipv6 address fdfd::ff:fe00:10
|
//#define HARD_CODED_ADDRESS "fdfd::10" //assign prefix and ipv6 address fdfd::ff:fe00:10
|
||||||
|
|
||||||
|
/* The status.shtml page shows addresses, neighbors, and routes on ipv6 builds. Use this define to enable
|
||||||
|
* the needed routines in httpd-cgi.c on the webserver6 build. The status page is present in
|
||||||
|
* /apps/webserver/httpd-fs/ but not in the default /apps/webserver/httpd-fsdata.c file.
|
||||||
|
* To include it run the PERL script /../../tools/makefsdata from the /apps/webserver/ directory.
|
||||||
|
* NB: Webserver builds on all platforms will use the current httpd-fsdata.c file. The added 160 bytes
|
||||||
|
* could overflow memory on the smaller platforms.
|
||||||
|
*/
|
||||||
|
#define WEBSERVER_CONF_STATUSPAGE 1
|
||||||
|
|
||||||
/* RPL currently works only on Windows. *nix would require converting the tun interface to two pcap tees. */
|
/* RPL currently works only on Windows. *nix would require converting the tun interface to two pcap tees. */
|
||||||
#define UIP_CONF_IPV6_RPL 0
|
#define UIP_CONF_IPV6_RPL 0
|
||||||
#define RPL_BORDER_ROUTER 0
|
#define RPL_BORDER_ROUTER 0
|
||||||
|
@ -83,9 +92,14 @@ typedef unsigned short uip_stats_t;
|
||||||
* Different instances can be made by changing the link layer portion of HARD_CODED_ADDRESS in contiki-main.c
|
* Different instances can be made by changing the link layer portion of HARD_CODED_ADDRESS in contiki-main.c
|
||||||
* Rename them to e.g. webserver6.10, webserver6.11, ...
|
* Rename them to e.g. webserver6.10, webserver6.11, ...
|
||||||
* They should all attach to a minimal-net rpl border that uses the same primary interface.
|
* They should all attach to a minimal-net rpl border that uses the same primary interface.
|
||||||
|
* For multihop testing, configure intermediate notes as routers.
|
||||||
*/
|
*/
|
||||||
#define RPL_CONF_ADJUST_LLH_LEN 1
|
#define RPL_CONF_ADJUST_LLH_LEN 1
|
||||||
#define HARD_CODED_ADDRESS "bbbb::10" //the prefix is ignored for a rpl end node
|
#define HARD_CODED_ADDRESS "bbbb::10" //the prefix is ignored for a rpl node
|
||||||
|
#define UIP_CONF_ROUTER 0
|
||||||
|
#define UIP_CONF_ND6_SEND_RA 0
|
||||||
|
#define UIP_CONF_ND6_REACHABLE_TIME 600000
|
||||||
|
#define UIP_CONF_ND6_RETRANS_TIMER 10000
|
||||||
|
|
||||||
#if RPL_BORDER_ROUTER
|
#if RPL_BORDER_ROUTER
|
||||||
/* RPL border router accepts packets from the host through the fallback and directs them to
|
/* RPL border router accepts packets from the host through the fallback and directs them to
|
||||||
|
@ -105,6 +119,7 @@ typedef unsigned short uip_stats_t;
|
||||||
* Possibly minimal-net RPL motes could also be added to this interface?
|
* Possibly minimal-net RPL motes could also be added to this interface?
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#undef UIP_CONF_ROUTER
|
||||||
#define UIP_CONF_ROUTER 1
|
#define UIP_CONF_ROUTER 1
|
||||||
//#define RPL_CONF_STATS 0
|
//#define RPL_CONF_STATS 0
|
||||||
//#define UIP_CONF_BUFFER_SIZE 1300
|
//#define UIP_CONF_BUFFER_SIZE 1300
|
||||||
|
@ -113,9 +128,9 @@ typedef unsigned short uip_stats_t;
|
||||||
//#define WPCAP_FALLBACK_ADDRESS "bbbb::1" //bbbb::1 is the default fallback prefix
|
//#define WPCAP_FALLBACK_ADDRESS "bbbb::1" //bbbb::1 is the default fallback prefix
|
||||||
#undef HARD_CODED_ADDRESS
|
#undef HARD_CODED_ADDRESS
|
||||||
#define HARD_CODED_ADDRESS "bbbb::1" //bbbb::ff:fe00:1 is the RPL border router default
|
#define HARD_CODED_ADDRESS "bbbb::1" //bbbb::ff:fe00:1 is the RPL border router default
|
||||||
#define UIP_CONF_ND6_SEND_RA 0
|
//#define UIP_CONF_ND6_SEND_RA 0
|
||||||
#define UIP_CONF_ND6_REACHABLE_TIME 600000
|
//#define UIP_CONF_ND6_REACHABLE_TIME 600000
|
||||||
#define UIP_CONF_ND6_RETRANS_TIMER 10000
|
//#define UIP_CONF_ND6_RETRANS_TIMER 10000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -173,7 +173,7 @@ main(void)
|
||||||
* ::10 becomes fe80::ff:fe00:10 and prefix awaits RA or RPL formation
|
* ::10 becomes fe80::ff:fe00:10 and prefix awaits RA or RPL formation
|
||||||
* bbbb:: gives an address of bbbb::206:98ff:fe00:232 if non-RPL
|
* bbbb:: gives an address of bbbb::206:98ff:fe00:232 if non-RPL
|
||||||
*/
|
*/
|
||||||
//#define HARD_CODED_ADDRESS "bbbb::40"
|
//#define HARD_CODED_ADDRESS "bbbb::20"
|
||||||
#ifdef HARD_CODED_ADDRESS
|
#ifdef HARD_CODED_ADDRESS
|
||||||
{
|
{
|
||||||
uip_ipaddr_t ipaddr;
|
uip_ipaddr_t ipaddr;
|
||||||
|
@ -191,11 +191,12 @@ main(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
process_init();
|
process_init();
|
||||||
|
/* procinit_init initializes RPL which sets a ctimer for the first DIS */
|
||||||
procinit_init();
|
/* We must start etimers and ctimers,before calling it */
|
||||||
|
process_start(&etimer_process, NULL);
|
||||||
ctimer_init();
|
ctimer_init();
|
||||||
|
|
||||||
|
procinit_init();
|
||||||
autostart_start(autostart_processes);
|
autostart_start(autostart_processes);
|
||||||
|
|
||||||
#if RPL_BORDER_ROUTER
|
#if RPL_BORDER_ROUTER
|
||||||
|
|
Loading…
Reference in a new issue