diff --git a/net/pkt/pkt_input.c b/net/pkt/pkt_input.c index 637707ec2e8..614f53a8dbf 100644 --- a/net/pkt/pkt_input.c +++ b/net/pkt/pkt_input.c @@ -117,7 +117,6 @@ int pkt_input(struct net_driver_s *dev) */ nwarn("WARNING: Packet not processed\n"); - //dev->d_len = 0; REVISIT ret = ERROR; } } diff --git a/net/pkt/pkt_poll.c b/net/pkt/pkt_poll.c index f913b25abcd..0379d9b2947 100644 --- a/net/pkt/pkt_poll.c +++ b/net/pkt/pkt_poll.c @@ -80,7 +80,7 @@ void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn) { /* Verify that the packet connection is valid */ - if (conn) + if (conn != NULL) { /* Setup for the application callback */ @@ -92,11 +92,10 @@ void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn) (void)pkt_callback(dev, conn, PKT_POLL); - /* If the application has data to send, setup the UDP/IP header */ + /* Check if the application has data to send */ if (dev->d_sndlen > 0) { - //devif_pkt_send(dev, conn); return; } } diff --git a/net/pkt/pkt_sockif.c b/net/pkt/pkt_sockif.c index f109882f524..3ebcea32abc 100644 --- a/net/pkt/pkt_sockif.c +++ b/net/pkt/pkt_sockif.c @@ -368,7 +368,7 @@ static int pkt_bind(FAR struct socket *psock, FAR const struct sockaddr *addr, /* Look at the addr and identify network interface */ - ifindex = ((struct sockaddr_ll*)addr)->sll_ifindex; + ifindex = ((FAR struct sockaddr_ll *)addr)->sll_ifindex; /* Get the MAC address of that interface */ diff --git a/net/procfs/net_procfs.c b/net/procfs/net_procfs.c index 63fa2a4881f..490d2ab58ee 100644 --- a/net/procfs/net_procfs.c +++ b/net/procfs/net_procfs.c @@ -492,7 +492,7 @@ static int netprocfs_readdir(FAR struct fs_dirent_s *dir) if (index >= level1->base.nentries) { - /* We signal the end of the directory by returning the special + /* We signal the end of the directory by returning the special * error -ENOENT. */ diff --git a/net/route/net_add_fileroute.c b/net/route/net_add_fileroute.c index c540212b027..458a09834e2 100644 --- a/net/route/net_add_fileroute.c +++ b/net/route/net_add_fileroute.c @@ -46,7 +46,6 @@ #include #include -//#include #include #include "route/fileroute.h" diff --git a/net/route/net_cacheroute.c b/net/route/net_cacheroute.c index 3f59487c55f..ceccd4702f0 100644 --- a/net/route/net_cacheroute.c +++ b/net/route/net_cacheroute.c @@ -74,7 +74,7 @@ (rr)->head = NULL; \ (rr)->tail = NULL; \ } \ - while (0) \ + while (0) /**************************************************************************** * Public Types diff --git a/net/route/net_del_fileroute.c b/net/route/net_del_fileroute.c index 4065fbff461..d5d3450445f 100644 --- a/net/route/net_del_fileroute.c +++ b/net/route/net_del_fileroute.c @@ -276,7 +276,7 @@ int net_delroute_ipv4(in_addr_t target, in_addr_t netmask) if (pos < 0) { nerr("ERROR: net_readroute_ipv4 failed: %ld\n", (long)pos); - ret =(int)pos; + ret = (int)pos; goto errout_with_fshandle; } @@ -302,7 +302,7 @@ int net_delroute_ipv4(in_addr_t target, in_addr_t netmask) if (pos < 0) { nerr("ERROR: net_readroute_ipv4 failed: %ld\n", (long)pos); - ret =(int)pos; + ret = (int)pos; goto errout_with_fshandle; } @@ -425,7 +425,7 @@ int net_delroute_ipv6(net_ipv6addr_t target, net_ipv6addr_t netmask) if (pos < 0) { nerr("ERROR: net_readroute_ipv6 failed: %ld\n", (long)pos); - ret =(int)pos; + ret = (int)pos; goto errout_with_fshandle; } @@ -451,7 +451,7 @@ int net_delroute_ipv6(net_ipv6addr_t target, net_ipv6addr_t netmask) if (pos < 0) { nerr("ERROR: net_readroute_ipv6 failed: %ld\n", (long)pos); - ret =(int)pos; + ret = (int)pos; goto errout_with_fshandle; } diff --git a/net/route/net_queue_ramroute.c b/net/route/net_queue_ramroute.c index bee549c56e4..abc06e4d943 100644 --- a/net/route/net_queue_ramroute.c +++ b/net/route/net_queue_ramroute.c @@ -162,7 +162,7 @@ FAR struct net_route_ipv6_entry_s * * * Description: * Remove the entry in the IPv4/IPv6 routing table list after the specified - entry. + * entry. * * Input Parameters: * entry - A pointer to the new entry to add to the list diff --git a/net/route/ramroute.h b/net/route/ramroute.h index 2705fd36466..e0231931fe5 100644 --- a/net/route/ramroute.h +++ b/net/route/ramroute.h @@ -68,7 +68,7 @@ (rr)->head = NULL; \ (rr)->tail = NULL; \ } \ - while (0) \ + while (0) /**************************************************************************** * Public Types diff --git a/net/sixlowpan/sixlowpan_framelist.c b/net/sixlowpan/sixlowpan_framelist.c index bd5b216bd39..b721522cedd 100644 --- a/net/sixlowpan/sixlowpan_framelist.c +++ b/net/sixlowpan/sixlowpan_framelist.c @@ -685,6 +685,7 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio, ninfo("Fragment offset=%d, paysize=%d, rb_dgramtag=%d\n", outlen >> 3, paysize, reass->rb_dgramtag); + sixlowpan_dumpbuffer("Outgoing frame", (FAR const uint8_t *)iob->io_data, iob->io_len); diff --git a/net/sixlowpan/sixlowpan_hc06.c b/net/sixlowpan/sixlowpan_hc06.c index 7b3ad8ae70a..9be889af3f9 100644 --- a/net/sixlowpan/sixlowpan_hc06.c +++ b/net/sixlowpan/sixlowpan_hc06.c @@ -182,7 +182,6 @@ static const uint8_t g_ttl_values[] = 0, 1, 64, 255 }; - /**************************************************************************** * Private Functions ****************************************************************************/ diff --git a/net/sixlowpan/sixlowpan_internal.h b/net/sixlowpan/sixlowpan_internal.h index d3689f7de0b..edb4e60f185 100644 --- a/net/sixlowpan/sixlowpan_internal.h +++ b/net/sixlowpan/sixlowpan_internal.h @@ -109,7 +109,7 @@ (ptr)[index] = ((uint16_t)(value) >> 8) & 0xff; \ (ptr)[index + 1] = (uint16_t)(value) & 0xff; \ } \ - while(0) + while (0) /* Return values ************************************************************/ diff --git a/net/sixlowpan/sixlowpan_utils.c b/net/sixlowpan/sixlowpan_utils.c index 8cf4481badc..e0b88ee417b 100644 --- a/net/sixlowpan/sixlowpan_utils.c +++ b/net/sixlowpan/sixlowpan_utils.c @@ -272,44 +272,44 @@ int sixlowpan_destaddrfromip(FAR struct radio_driver_s *radio, #else /* CONFIG_NET_STARPOINT */ - /* Check for a multicast address */ + /* Check for a multicast address */ - if (net_is_addr_mcast(ipaddr)) - { - DEBUGASSERT(radio->r_properties != NULL); - ret = radio->r_properties(radio, &properties); - if (ret < 0) - { - return ret; - } + if (net_is_addr_mcast(ipaddr)) + { + DEBUGASSERT(radio->r_properties != NULL); + ret = radio->r_properties(radio, &properties); + if (ret < 0) + { + return ret; + } - /* Check for the broadcast IP address - * - * IPv6 does not implement the method of broadcast, and therefore - * does not define broadcast addresses. Instead, IPv6 uses multicast - * addressing to the all-nodes multicast group: ff02:0:0:0:0:0:0:1. - * - * However, the use of the all-nodes group is not common, and most - * IPv6 protocols use a dedicated link-local multicast group to avoid - * disturbing every interface in the network. - */ + /* Check for the broadcast IP address + * + * IPv6 does not implement the method of broadcast, and therefore + * does not define broadcast addresses. Instead, IPv6 uses multicast + * addressing to the all-nodes multicast group: ff02:0:0:0:0:0:0:1. + * + * However, the use of the all-nodes group is not common, and most + * IPv6 protocols use a dedicated link-local multicast group to avoid + * disturbing every interface in the network. + */ - if (net_ipv6addr_cmp(ipaddr, g_ipv6_allnodes)) - { - memcpy(destaddr, &properties.sp_bcast, - sizeof(struct netdev_varaddr_s)); - } + if (net_ipv6addr_cmp(ipaddr, g_ipv6_allnodes)) + { + memcpy(destaddr, &properties.sp_bcast, + sizeof(struct netdev_varaddr_s)); + } - /* Some other RFC 3513 multicast address */ + /* Some other RFC 3513 multicast address */ - else - { - memcpy(destaddr, &properties.sp_mcast, - sizeof(struct netdev_varaddr_s)); - } + else + { + memcpy(destaddr, &properties.sp_mcast, + sizeof(struct netdev_varaddr_s)); + } - return OK; - } + return OK; + } /* Otherwise, the destination MAC address is encoded in the IP address */ diff --git a/net/socket/getsockopt.c b/net/socket/getsockopt.c index eef6e0f790c..d027da2fdf9 100644 --- a/net/socket/getsockopt.c +++ b/net/socket/getsockopt.c @@ -211,8 +211,8 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option, /* Return the actual socket type */ - *(int*)value = conn->type; - *value_len = sizeof(int); + *(FAR int *)value = conn->type; + *value_len = sizeof(int); break; } diff --git a/net/socket/send.c b/net/socket/send.c index 21deb8c4ed4..7d95a6f1f69 100644 --- a/net/socket/send.c +++ b/net/socket/send.c @@ -231,7 +231,7 @@ ssize_t send(int sockfd, FAR const void *buf, size_t len, int flags) (void)enter_cancellation_point(); - /* Let nx_send() and psock_send() do all of the work*/ + /* Let nx_send() and psock_send() do all of the work */ ret = nx_send(sockfd, buf, len, flags); if (ret < 0) diff --git a/net/tcp/tcp_conn.c b/net/tcp/tcp_conn.c index 507dd96cd05..1ba18b8131a 100644 --- a/net/tcp/tcp_conn.c +++ b/net/tcp/tcp_conn.c @@ -381,8 +381,8 @@ static inline FAR struct tcp_conn_s * * connection to be used with the provided TCP/IP header * * Assumptions: - * This function is called from network logic with the nework locked. -4 * + * This function is called from network logic with the network locked. + * ****************************************************************************/ #ifdef CONFIG_NET_IPv6 diff --git a/net/tcp/tcp_connect.c b/net/tcp/tcp_connect.c index c8d64a3e8a0..8ab964568aa 100644 --- a/net/tcp/tcp_connect.c +++ b/net/tcp/tcp_connect.c @@ -90,7 +90,7 @@ static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev, * Private Functions ****************************************************************************/ - /**************************************************************************** +/**************************************************************************** * Name: psock_setup_callbacks ****************************************************************************/ diff --git a/net/tcp/tcp_monitor.c b/net/tcp/tcp_monitor.c index 95b0c57f0d6..57b99dabbb7 100644 --- a/net/tcp/tcp_monitor.c +++ b/net/tcp/tcp_monitor.c @@ -217,7 +217,7 @@ static void tcp_shutdown_monitor(FAR struct tcp_conn_s *conn, uint16_t flags) net_lock(); (void)tcp_callback(conn->dev, conn, flags); - /* Free all allocated connection event callback structure s*/ + /* Free all allocated connection event callback structures */ while (conn->connevents != NULL) { diff --git a/net/tcp/tcp_netpoll.c b/net/tcp/tcp_netpoll.c index 82085c82a29..b1d37f3135a 100644 --- a/net/tcp/tcp_netpoll.c +++ b/net/tcp/tcp_netpoll.c @@ -60,6 +60,7 @@ /**************************************************************************** * Private Types ****************************************************************************/ + /* This is an allocated container that holds the poll-related information */ struct tcp_poll_s diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c index 47720b65215..89734af6b06 100644 --- a/net/tcp/tcp_send_unbuffered.c +++ b/net/tcp/tcp_send_unbuffered.c @@ -826,7 +826,6 @@ ssize_t psock_tcp_send(FAR struct socket *psock, } #endif /* CONFIG_NET_ARP_SEND */ - #ifdef CONFIG_NET_ICMPv6_NEIGHBOR #ifdef CONFIG_NET_ARP_SEND else diff --git a/net/tcp/tcp_sendfile.c b/net/tcp/tcp_sendfile.c index 4496447a846..9b250e68411 100644 --- a/net/tcp/tcp_sendfile.c +++ b/net/tcp/tcp_sendfile.c @@ -662,7 +662,7 @@ ssize_t tcp_sendfile(FAR struct socket *psock, FAR struct file *infile, if (state.snd_datacb == NULL) { nerr("ERROR: Failed to allocate data callback\n"); - ret =- ENOMEM; + ret = -ENOMEM; goto errout_locked; } diff --git a/net/udp/udp_netpoll.c b/net/udp/udp_netpoll.c index 245e6419697..d05b63d19fa 100644 --- a/net/udp/udp_netpoll.c +++ b/net/udp/udp_netpoll.c @@ -59,6 +59,7 @@ /**************************************************************************** * Private Types ****************************************************************************/ + /* This is an allocated container that holds the poll-related information */ struct udp_poll_s diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c index 6d209c94025..d6cceb8feb2 100644 --- a/net/udp/udp_psock_sendto_buffered.c +++ b/net/udp/udp_psock_sendto_buffered.c @@ -389,16 +389,16 @@ static int sendto_next_transfer(FAR struct socket *psock, return ret; } - /* Get the device that will handle the remote packet transfers. This - * should never be NULL. - */ + /* Get the device that will handle the remote packet transfers. This + * should never be NULL. + */ - dev = udp_find_raddr_device(conn); - if (dev == NULL) - { - nerr("ERROR: udp_find_raddr_device failed\n"); - return -ENETUNREACH; - } + dev = udp_find_raddr_device(conn); + if (dev == NULL) + { + nerr("ERROR: udp_find_raddr_device failed\n"); + return -ENETUNREACH; + } /* Make sure that the device is in the UP state */ diff --git a/net/usrsock/usrsock_dev.c b/net/usrsock/usrsock_dev.c index 701f2ed2e68..14bc239a543 100644 --- a/net/usrsock/usrsock_dev.c +++ b/net/usrsock/usrsock_dev.c @@ -88,7 +88,7 @@ struct usrsockdev_s sem_t acksem; /* Request acknowledgment notification */ uint8_t ack_xid; /* Exchange id for which waiting ack */ uint16_t nbusy; /* Number of requests blocked from different - threads */ + * threads */ } req; FAR struct usrsock_conn_s *datain_conn; /* Connection instance to receive @@ -733,9 +733,9 @@ static ssize_t usrsockdev_handle_req_response(FAR struct usrsockdev_s *dev, FAR struct usrsock_conn_s *conn; unsigned int hdrlen; ssize_t ret; - ssize_t (* handle_response)(FAR struct usrsockdev_s *dev, - FAR struct usrsock_conn_s *conn, - FAR const void *buffer); + ssize_t (*handle_response)(FAR struct usrsockdev_s *dev, + FAR struct usrsock_conn_s *conn, + FAR const void *buffer); switch (hdr->head.msgid) { diff --git a/net/utils/utils.h b/net/utils/utils.h index 41f0c9dcfe1..13d2dded7ba 100644 --- a/net/utils/utils.h +++ b/net/utils/utils.h @@ -330,6 +330,7 @@ uint16_t tcp_ipv4_chksum(FAR struct net_driver_s *dev); #ifdef CONFIG_NET_IPv6 /* REVIST: Is this used? */ + uint16_t tcp_ipv6_chksum(FAR struct net_driver_s *dev); #endif diff --git a/tools/nxstyle.c b/tools/nxstyle.c index 63c203c70c1..089a252f33e 100644 --- a/tools/nxstyle.c +++ b/tools/nxstyle.c @@ -131,7 +131,7 @@ int main(int argc, char **argv, char **envp) blank_lineno = lineno; } - else /* this line is non-blank */ + else /* This line is non-blank */ { /* Check for a missing blank line after a comment */ @@ -139,6 +139,10 @@ int main(int argc, char **argv, char **envp) { /* No blank line should be present if the current line contains * a right brace or a pre-processor line. + * + * REVISIT: Generates a false alarm if the current line is also + * a comment. Generally it is acceptable for one comment to + * follow another with no space separation. */ if (line[n] != '}' && line[n] != '#') @@ -534,6 +538,10 @@ int main(int argc, char **argv, char **envp) if (prevdeclnest <= 0 || declnest > 0) { + /* REVISIT: Generates false alarms on named structures + * that are fields of other structures or unions. + */ + fprintf(stderr, "Garbage follows right bracket at line %d:%d\n", lineno, n);