Networking: Misck IPv6 detanglement

This commit is contained in:
Gregory Nutt
2015-01-15 12:19:44 -06:00
parent a40189bcd8
commit 5a441ce03b
28 changed files with 495 additions and 307 deletions
+3 -3
View File
@@ -123,7 +123,7 @@ void arp_arpin(FAR struct net_driver_s *dev)
/* ARP request. If it asked for our address, we send out a reply. */
if (net_ipaddr_cmp(ipaddr, dev->d_ipaddr))
if (net_ipv4addr_cmp(ipaddr, dev->d_ipaddr))
{
struct eth_hdr_s *peth = ETHBUF;
@@ -142,7 +142,7 @@ void arp_arpin(FAR struct net_driver_s *dev)
parp->ah_dipaddr[0] = parp->ah_sipaddr[0];
parp->ah_dipaddr[1] = parp->ah_sipaddr[1];
net_ipaddr_hdrcopy(parp->ah_sipaddr, &dev->d_ipaddr);
net_ipv4addr_hdrcopy(parp->ah_sipaddr, &dev->d_ipaddr);
arp_dump(parp);
peth->type = HTONS(ETHTYPE_ARP);
@@ -157,7 +157,7 @@ void arp_arpin(FAR struct net_driver_s *dev)
* for us.
*/
if (net_ipaddr_cmp(ipaddr, dev->d_ipaddr))
if (net_ipv4addr_cmp(ipaddr, dev->d_ipaddr))
{
/* Yes... Insert the address mapping in the ARP table */
+2 -2
View File
@@ -105,8 +105,8 @@ void arp_format(FAR struct net_driver_s *dev, in_addr_t ipaddr)
memcpy(eth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN);
memcpy(arp->ah_shwaddr, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN);
net_ipaddr_hdrcopy(arp->ah_dipaddr, &ipaddr);
net_ipaddr_hdrcopy(arp->ah_sipaddr, &dev->d_ipaddr);
net_ipv4addr_hdrcopy(arp->ah_dipaddr, &ipaddr);
net_ipv4addr_hdrcopy(arp->ah_sipaddr, &dev->d_ipaddr);
arp->ah_opcode = HTONS(ARP_REQUEST);
arp->ah_hwtype = HTONS(ARP_HWTYPE_ETH);
+1 -1
View File
@@ -99,7 +99,7 @@ void arp_ipin(FAR struct net_driver_s *dev)
*/
srcipaddr = net_ip4addr_conv32(IPBUF->eh_srcipaddr);
if (net_ipaddr_maskcmp(srcipaddr, dev->d_ipaddr, dev->d_netmask))
if (net_ipv4addr_maskcmp(srcipaddr, dev->d_ipaddr, dev->d_netmask))
{
arp_update(IPBUF->eh_srcipaddr, ETHBUF->src);
}
+6 -6
View File
@@ -92,7 +92,7 @@ static const uint16_t g_broadcast_ipaddr[2] = {0xffff, 0xffff};
* The following is the first three octects of the IGMP address:
*/
#if defined(CONFIG_NET_IGMP) && !defined(CONFIG_NET_IPv6)
#ifdef CONFIG_NET_IGMP
static const uint8_t g_multicast_ethaddr[3] = {0x01, 0x00, 0x5e};
#endif
@@ -163,12 +163,12 @@ void arp_out(FAR struct net_driver_s *dev)
/* First check if destination is a local broadcast. */
if (net_ipaddr_hdrcmp(pip->eh_destipaddr, g_broadcast_ipaddr))
if (net_ipv4addr_hdrcmp(pip->eh_destipaddr, g_broadcast_ipaddr))
{
memcpy(peth->dest, g_broadcast_ethaddr.ether_addr_octet, ETHER_ADDR_LEN);
}
#if defined(CONFIG_NET_IGMP) && !defined(CONFIG_NET_IPv6)
#ifdef CONFIG_NET_IGMP
/* Check if the destination address is a multicast address
*
* - IPv4: multicast addresses lie in the class D group -- The address range
@@ -196,7 +196,7 @@ void arp_out(FAR struct net_driver_s *dev)
/* Check if the destination address is on the local network. */
destipaddr = net_ip4addr_conv32(pip->eh_destipaddr);
if (!net_ipaddr_maskcmp(destipaddr, dev->d_ipaddr, dev->d_netmask))
if (!net_ipv4addr_maskcmp(destipaddr, dev->d_ipaddr, dev->d_netmask))
{
/* Destination address is not on the local network */
@@ -213,14 +213,14 @@ void arp_out(FAR struct net_driver_s *dev)
* destination address when determining the MAC address.
*/
net_ipaddr_copy(ipaddr, dev->d_draddr);
net_ipv4addr_copy(ipaddr, dev->d_draddr);
#endif
}
else
{
/* Else, we use the destination IP address. */
net_ipaddr_copy(ipaddr, destipaddr);
net_ipv4addr_copy(ipaddr, destipaddr);
}
/* Check if we already have this destination address in the ARP table */
+5 -5
View File
@@ -202,7 +202,7 @@ int arp_send(in_addr_t ipaddr)
return OK;
}
#if defined(CONFIG_NET_IGMP) && !defined(CONFIG_NET_IPv6)
#ifdef CONFIG_NET_IGMP
/* Check if the destination address is a multicast address
*
* - IPv4: multicast addresses lie in the class D group -- The address range
@@ -250,9 +250,9 @@ int arp_send(in_addr_t ipaddr)
/* Check if the destination address is on the local network. */
if (!net_ipaddr_maskcmp(ipaddr, dev->d_ipaddr, dev->d_netmask))
if (!net_ipv4addr_maskcmp(ipaddr, dev->d_ipaddr, dev->d_netmask))
{
net_ipaddr_t dripaddr;
in_addr_t dripaddr;
/* Destination address is not on the local network */
@@ -270,7 +270,7 @@ int arp_send(in_addr_t ipaddr)
* destination address when determining the MAC address.
*/
net_ipaddr_copy(dripaddr, dev->d_draddr);
net_ipv4addr_copy(dripaddr, dev->d_draddr);
#endif
ipaddr = dripaddr;
}
@@ -338,7 +338,7 @@ int arp_send(in_addr_t ipaddr)
/* Notify the device driver that new TX data is available.
* NOTES: This is in essence what netdev_txnotify() does, which
* is not possible to call since it expects a net_ipaddr_t as
* is not possible to call since it expects a in_addr_t as
* its single argument to lookup the network interface.
*/
+2 -2
View File
@@ -173,7 +173,7 @@ void arp_update(FAR uint16_t *pipaddr, FAR uint8_t *ethaddr)
* the IP address in this ARP table entry.
*/
if (net_ipaddr_cmp(ipaddr, tabptr->at_ipaddr))
if (net_ipv4addr_cmp(ipaddr, tabptr->at_ipaddr))
{
/* An old entry found, update this and return. */
@@ -252,7 +252,7 @@ FAR struct arp_entry *arp_find(in_addr_t ipaddr)
for (i = 0; i < CONFIG_NET_ARPTAB_SIZE; ++i)
{
tabptr = &g_arptable[i];
if (net_ipaddr_cmp(ipaddr, tabptr->at_ipaddr))
if (net_ipv4addr_cmp(ipaddr, tabptr->at_ipaddr))
{
return tabptr;
}