Skip to content
Snippets Groups Projects
Commit 5e617f84 authored by Gregory Nutt's avatar Gregory Nutt
Browse files

UDP networking: The TTL (time to live) was not being set in the IPv4 or IPv6...

UDP networking:  The TTL (time to live) was not being set in the IPv4 or IPv6 header unless the UDP socket was bound.
parent c0c275c8
No related branches found
No related tags found
No related merge requests found
...@@ -106,18 +106,20 @@ static int ipv6_packet_conversion(FAR struct net_driver_s *dev, ...@@ -106,18 +106,20 @@ static int ipv6_packet_conversion(FAR struct net_driver_s *dev,
{ {
/* Otherwise, we will have to drop the packet */ /* Otherwise, we will have to drop the packet */
nwarn("WARNING: Dropping. Unsupported 6LoWPAN protocol: %d\n", nwarn("WARNING: Dropping. Unsupported 6LoWPAN protocol: %d\n",
ipv6->proto); ipv6->proto);
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
g_netstats.ipv6.drop++; g_netstats.ipv6.drop++;
#endif #endif
return -EPROTONOSUPPORT;
} }
dev->d_len = 0; dev->d_len = 0;
return OK; return OK;
} }
nwarn("WARNING: Dropping. Unsupported link layer\n");
return -EPFNOSUPPORT; return -EPFNOSUPPORT;
} }
#else #else
...@@ -515,6 +517,7 @@ int ipv6_forward(FAR struct net_driver_s *dev, FAR struct ipv6_hdr_s *ipv6) ...@@ -515,6 +517,7 @@ int ipv6_forward(FAR struct net_driver_s *dev, FAR struct ipv6_hdr_s *ipv6)
ret = ipv6_decr_ttl(ipv6); ret = ipv6_decr_ttl(ipv6);
if (ret < 1) if (ret < 1)
{ {
nwarn("WARNING: Hop limit exceeded... Dropping!\n");
ret = -EMULTIHOP; ret = -EMULTIHOP;
goto drop; goto drop;
} }
...@@ -548,6 +551,7 @@ int ipv6_forward(FAR struct net_driver_s *dev, FAR struct ipv6_hdr_s *ipv6) ...@@ -548,6 +551,7 @@ int ipv6_forward(FAR struct net_driver_s *dev, FAR struct ipv6_hdr_s *ipv6)
ret = ipv6_dev_forward(dev, fwddev, ipv6); ret = ipv6_dev_forward(dev, fwddev, ipv6);
if (ret < 0) if (ret < 0)
{ {
nwarn("WARNING: ipv6_dev_forward faield: %d\n", ret);
goto drop; goto drop;
} }
} }
......
...@@ -370,6 +370,7 @@ int ipv6_input(FAR struct net_driver_s *dev) ...@@ -370,6 +370,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
{ {
/* Not destined for us and not forwardable... drop the packet. */ /* Not destined for us and not forwardable... drop the packet. */
nwarn("WARNING: Not destined for us; not forwardable... Dropping!\n");
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
g_netstats.ipv6.drop++; g_netstats.ipv6.drop++;
#endif #endif
......
...@@ -457,6 +457,7 @@ FAR struct udp_conn_s *udp_alloc(uint8_t domain) ...@@ -457,6 +457,7 @@ FAR struct udp_conn_s *udp_alloc(uint8_t domain)
conn->domain = domain; conn->domain = domain;
#endif #endif
conn->lport = 0; conn->lport = 0;
conn->ttl = IP_TTL;
/* Enqueue the connection into the active list */ /* Enqueue the connection into the active list */
...@@ -760,7 +761,6 @@ int udp_connect(FAR struct udp_conn_s *conn, FAR const struct sockaddr *addr) ...@@ -760,7 +761,6 @@ int udp_connect(FAR struct udp_conn_s *conn, FAR const struct sockaddr *addr)
#endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NET_IPv6 */
} }
conn->ttl = IP_TTL;
return OK; return OK;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment