Skip to content

Commit

Permalink
Merge branch 'md-jamal-blip-rfc6282'
Browse files Browse the repository at this point in the history
  • Loading branch information
bradjc committed Jul 7, 2014
2 parents 5427066 + 698e5cd commit 93f83c7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
6 changes: 2 additions & 4 deletions support/sdk/c/blip/lib6lowpan/lib6lowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,8 @@ uint8_t *pack_address(uint8_t *buf,
memcpy(buf, &addr->s6_addr[14], 2);
return buf += 2;
} else if (/* maybe it's a 16-bit address with the IID derived from the
PANID + address */
(addr->s6_addr16[4] == htons(letohs(pan) & ~0x0200) &&
addr->s6_addr16[5] == htons(0x00ff) &&
802.15.4 address(RFC 6282 Section 3.2.2) */
(addr->s6_addr16[5] == htons(0x00ff) &&
addr->s6_addr16[6] == htons(0xfe00) &&
(((l2addr->ieee_mode == IEEE154_ADDR_SHORT) &&
addr->s6_addr16[7] == htons(letohs(l2addr->i_saddr))))) ||
Expand Down Expand Up @@ -659,7 +658,6 @@ int unpack_address(struct in6_addr *addr,
addr->s6_addr[i+8] = frame->i_laddr.data[7-i];
addr->s6_addr[8] ^= 0x2;
} else {
addr->s6_addr16[4] = htons(letohs(pan) & ~0x0200);
addr->s6_addr[11] = 0xff;
addr->s6_addr[12] = 0xfe;
addr->s6_addr16[7] = leton16(frame->i_saddr);
Expand Down
6 changes: 1 addition & 5 deletions tos/lib/net/blip/IPAddressP.nc
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ module IPAddressP {
struct in6_addr m_addr;

command bool IPAddress.getLLAddr(struct in6_addr *addr) {
ieee154_panid_t panid = letohs(call Ieee154Address.getPanId());
ieee154_saddr_t saddr = letohs(call Ieee154Address.getShortAddr());
ieee154_laddr_t laddr = call Ieee154Address.getExtAddr();

memclr(addr->s6_addr, 16);
addr->s6_addr16[0] = htons(0xfe80);
if (m_short_addr) {
addr->s6_addr16[4] = htons(panid);
addr->s6_addr16[5] = htons(0x00FF);
addr->s6_addr16[6] = htons(0xFE00);
addr->s6_addr16[7] = htons(saddr);
Expand Down Expand Up @@ -90,7 +88,6 @@ module IPAddressP {
}

command bool IPAddress.isLocalAddress(struct in6_addr *addr) {
ieee154_panid_t panid = letohs(call Ieee154Address.getPanId());
ieee154_saddr_t saddr = letohs(call Ieee154Address.getShortAddr());
ieee154_laddr_t eui = call Ieee154Address.getExtAddr();

Expand All @@ -99,8 +96,7 @@ module IPAddressP {
if (m_short_addr &&
addr->s6_addr16[5] == htons(0x00FF) &&
addr->s6_addr16[6] == htons(0xFE00)) {
if (ntohs(addr->s6_addr16[4]) == (panid & ~0x200) &&
ntohs(addr->s6_addr16[7]) == saddr) {
if(ntohs(addr->s6_addr16[7]) == saddr) {
return TRUE;
} else {
return FALSE;
Expand Down
11 changes: 10 additions & 1 deletion tos/lib/net/blip/IPDispatchP.nc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ int lowpan_extern_match_context(struct in6_addr *addr, uint8_t *ctx_id) {
};
uint8_t state = S_STOPPED;
bool radioBusy;
bool ack_required=TRUE;
uint8_t current_local_label = 0;
ip_statistics_t stats;

Expand Down Expand Up @@ -495,6 +496,13 @@ void SENDINFO_DECR(struct send_info *si) {
return EOFF;
}


//check whether the destination address is a multicast address or not
if(frame_addr->ieee_dst.i_saddr==IEEE154_BROADCAST_ADDR)
ack_Required=FALSE;
else
ack_Required=TRUE;

/* set version to 6 in case upper layers forgot */
msg->ip6_hdr.ip6_vfc &= ~IPV6_VERSION_MASK;
msg->ip6_hdr.ip6_vfc |= IPV6_VERSION;
Expand Down Expand Up @@ -596,7 +604,8 @@ void SENDINFO_DECR(struct send_info *si) {
s_entry->info->link_transmissions += (call PacketLink.getRetries(msg));
s_entry->info->link_fragment_attempts++;

if (!call PacketLink.wasDelivered(msg)) {
//acknowledgements are not required for multicast packets, useful for fragmentation
if (!call PacketLink.wasDelivered(msg) && ack_Required) {
printf("sendDone: was not delivered! (%i tries)\n",
call PacketLink.getRetries(msg));
s_entry->info->failed = TRUE;
Expand Down
8 changes: 2 additions & 6 deletions tos/lib/net/blip/IPNeighborDiscoveryP.nc
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,9 @@ module IPNeighborDiscoveryP {
if (addr->s6_addr16[0] == htons(0xfe80)) {
if (addr->s6_addr16[5] == htons(0x00FF) &&
addr->s6_addr16[6] == htons(0xFE00)) {
/* U bit must not be set if a short address is in use */
if (ntohs(addr->s6_addr16[4]) == (panid & ~0x0200)) {
/* U bit must not be set if a short address is in use */
link_addr->ieee_mode = IEEE154_ADDR_SHORT;
link_addr->i_saddr = htole16(ntohs(addr->s6_addr16[7]));
} else {
return FAIL;
}
link_addr->i_saddr = htole16(ntohs(addr->s6_addr16[7]));
} else {
int i;
link_addr->ieee_mode = IEEE154_ADDR_EXT;
Expand Down

0 comments on commit 93f83c7

Please sign in to comment.