Merge pull request #135 from darconeous/pull-requests/core-net-bridge-mode

core/net: Added support for "bridge mode".
This commit is contained in:
Adam Dunkels 2013-03-18 04:43:15 -07:00
commit f81e4071f1
4 changed files with 17 additions and 0 deletions

View file

@ -549,7 +549,10 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, struct rdc_buf_
return MAC_TX_ERR_FATAL;
}
#if !NETSTACK_CONF_BRIDGE_MODE
/* If NETSTACK_CONF_BRIDGE_MODE is set, assume PACKETBUF_ADDR_SENDER is already set. */
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
#endif
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
is_broadcast = 1;
PRINTDEBUG("contikimac: send broadcast\n");

View file

@ -429,7 +429,10 @@ send_packet(void)
/* Create the X-MAC header for the data packet. */
#if !NETSTACK_CONF_BRIDGE_MODE
/* If NETSTACK_CONF_BRIDGE_MODE is set, assume PACKETBUF_ADDR_SENDER is already set. */
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
#endif
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
is_broadcast = 1;
PRINTDEBUG("cxmac: send broadcast\n");

View file

@ -146,7 +146,11 @@ send_packet(mac_callback_t sent, void *ptr)
* Set up the source address using only the long address mode for
* phase 1.
*/
#if NETSTACK_CONF_BRIDGE_MODE
rimeaddr_copy((rimeaddr_t *)&params.src_addr,packetbuf_addr(PACKETBUF_ADDR_SENDER));
#else
rimeaddr_copy((rimeaddr_t *)&params.src_addr, &rimeaddr_node_addr);
#endif
params.payload = packetbuf_dataptr();
params.payload_len = packetbuf_datalen();
@ -203,12 +207,14 @@ input_packet(void)
}
if(!is_broadcast_addr(frame.fcf.dest_addr_mode, frame.dest_addr)) {
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (rimeaddr_t *)&frame.dest_addr);
#if !NETSTACK_CONF_BRIDGE_MODE
if(!rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_node_addr)) {
/* Not for this node */
PRINTF("6MAC: not for us\n");
return;
}
#endif
}
}
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (rimeaddr_t *)&frame.src_addr);

View file

@ -1329,6 +1329,11 @@ send_packet(rimeaddr_t *dest)
*/
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, dest);
#if NETSTACK_CONF_BRIDGE_MODE
/* This needs to be explicitly set here for bridge mode to work */
packetbuf_set_addr(PACKETBUF_ADDR_SENDER,(void*)&uip_lladdr);
#endif
/* Force acknowledge from sender (test hardware autoacks) */
#if SICSLOWPAN_CONF_ACK_ALL
packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, 1);