summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-07-14 17:09:45 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-07-14 17:09:45 +0000
commit2d00a7cfa8a9357a1b4a9d3118e70065431d98a2 (patch)
treee3963150cf5e4b6c6e834c30a9815f0d1cb0cd10
parent3b74613f636d3a08f12f4c3110ee4a5b46ecdb0b (diff)
downloadnuttx-2d00a7cfa8a9357a1b4a9d3118e70065431d98a2.tar.gz
nuttx-2d00a7cfa8a9357a1b4a9d3118e70065431d98a2.tar.bz2
nuttx-2d00a7cfa8a9357a1b4a9d3118e70065431d98a2.zip
Costmetic clean-up
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2799 42af7a65-404d-4744-a932-0658087f49c3
-rwxr-xr-xnuttx/net/uip/uip_igmpgroup.c7
-rwxr-xr-xnuttx/net/uip/uip_igmpinput.c7
-rwxr-xr-xnuttx/net/uip/uip_igmpjoin.c3
-rwxr-xr-xnuttx/net/uip/uip_igmpleave.c2
-rwxr-xr-xnuttx/net/uip/uip_igmpsend.c8
-rwxr-xr-xnuttx/net/uip/uip_igmptimer.c4
6 files changed, 22 insertions, 9 deletions
diff --git a/nuttx/net/uip/uip_igmpgroup.c b/nuttx/net/uip/uip_igmpgroup.c
index 495713e30..af1ecd93e 100755
--- a/nuttx/net/uip/uip_igmpgroup.c
+++ b/nuttx/net/uip/uip_igmpgroup.c
@@ -222,14 +222,17 @@ FAR struct igmp_group_s *uip_grpalloc(FAR struct uip_driver_s *dev,
irqstate_t flags;
nllvdbg("addr: %08x dev: %p\n", *addr, dev);
-#if CONFIG_PREALLOC_IGMPGROUPS > 0
if (up_interrupt_context())
{
+#if CONFIG_PREALLOC_IGMPGROUPS > 0
grplldbg("Use a pre-allocated group entry\n");
group = uip_grpprealloc();
+#else
+ grplldbg("Cannot allocate from interrupt handler\n");
+ group = NULL;
+#endif
}
else
-#endif
{
grplldbg("Allocate from the heap\n");
group = uip_grpheapalloc();
diff --git a/nuttx/net/uip/uip_igmpinput.c b/nuttx/net/uip/uip_igmpinput.c
index ed56d9adb..61803fcca 100755
--- a/nuttx/net/uip/uip_igmpinput.c
+++ b/nuttx/net/uip/uip_igmpinput.c
@@ -142,6 +142,11 @@ void uip_igmpinput(struct uip_driver_s *dev)
destipaddr = uip_ip4addr_conv(IGMPBUF->destipaddr);
group = uip_grpallocfind(dev, &destipaddr);
+ if (!group)
+ {
+ nlldbg("Failed to allocate/find group: %08x\n", destipaddr);
+ return;
+ }
/* Now handle the message based on the IGMP message type */
@@ -210,7 +215,7 @@ void uip_igmpinput(struct uip_driver_s *dev)
}
}
}
- else /* if (group->grpaddr != 0) */
+ else /* if (IGMPBUF->grpaddr != 0) */
{
nllvdbg("Group-specific multicast queury\n");
diff --git a/nuttx/net/uip/uip_igmpjoin.c b/nuttx/net/uip/uip_igmpjoin.c
index 0b193544b..34f319ec3 100755
--- a/nuttx/net/uip/uip_igmpjoin.c
+++ b/nuttx/net/uip/uip_igmpjoin.c
@@ -151,6 +151,9 @@ int igmp_joingroup(struct uip_driver_s *dev, FAR const struct in_addr *grpaddr)
uip_addmcastmac(dev, (FAR uip_ipaddr_t *)&grpaddr->s_addr);
return OK;
}
+
+ /* Return EEXIST if the address is already a member of the group */
+
return -EEXIST;
}
diff --git a/nuttx/net/uip/uip_igmpleave.c b/nuttx/net/uip/uip_igmpleave.c
index 85f6d78d7..276622399 100755
--- a/nuttx/net/uip/uip_igmpleave.c
+++ b/nuttx/net/uip/uip_igmpleave.c
@@ -173,6 +173,8 @@ int igmp_leavegroup(struct uip_driver_s *dev, FAR const struct in_addr *grpaddr)
return OK;
}
+ /* Return ENOENT if the address is not a member of the group */
+
nvdbg("Return -ENOENT\n");
return -ENOENT;
}
diff --git a/nuttx/net/uip/uip_igmpsend.c b/nuttx/net/uip/uip_igmpsend.c
index 7ea384e29..33575f7fe 100755
--- a/nuttx/net/uip/uip_igmpsend.c
+++ b/nuttx/net/uip/uip_igmpsend.c
@@ -162,14 +162,14 @@ void uip_igmpsend(FAR struct uip_driver_s *dev, FAR struct igmp_group_s *group,
/* Set up the IGMP message */
- IGMPBUF->type = group->msgid;
- IGMPBUF->maxresp = 0;
+ IGMPBUF->type = group->msgid;
+ IGMPBUF->maxresp = 0;
uiphdr_ipaddr_copy(IGMPBUF->grpaddr, &group->grpaddr);
/* Calculate the IGMP checksum. */
- IGMPBUF->chksum = 0;
- IGMPBUF->chksum = ~uip_igmpchksum(&IGMPBUF->type, UIP_IPIGMPH_LEN);
+ IGMPBUF->chksum = 0;
+ IGMPBUF->chksum = ~uip_igmpchksum(&IGMPBUF->type, UIP_IPIGMPH_LEN);
IGMP_STATINCR(uip_stats.igmp.poll_send);
IGMP_STATINCR(uip_stats.ip.sent);
diff --git a/nuttx/net/uip/uip_igmptimer.c b/nuttx/net/uip/uip_igmptimer.c
index 044276ec3..98d95479d 100755
--- a/nuttx/net/uip/uip_igmptimer.c
+++ b/nuttx/net/uip/uip_igmptimer.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * net/uip/uip_igmpleave.c
+ * net/uip/uip_igmptimer.c
*
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@@ -170,8 +170,8 @@ int uip_decisec2tick(int decisecs)
*/
return CLK_TCK * decisecs / 10;
-
}
+
/****************************************************************************
* Name: uip_igmpstartticks and uip_igmpstarttimer
*