[gPXE-devel] [PATCH 27/31] [ipv6] in icmp6, use ipv6_tx instead of tcpip_tx for consistency with the RX path

matthew at theiselins.net matthew at theiselins.net
Fri Jul 8 10:28:36 EDT 2011


From: Matthew Iselin <matthew at theiselins.net>

Signed-off-by: Matthew Iselin <matthew at theiselins.net>
---
 src/include/gpxe/ip6.h |    8 ++++++++
 src/net/icmpv6.c       |   16 ++++++++--------
 src/net/ipv6.c         |   12 ++++++------
 3 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/src/include/gpxe/ip6.h b/src/include/gpxe/ip6.h
index 5fc0d02..d533b92 100644
--- a/src/include/gpxe/ip6.h
+++ b/src/include/gpxe/ip6.h
@@ -11,6 +11,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 
 #include <stdint.h>
 #include <gpxe/in.h>
+#include <gpxe/tcpip.h>
 
 /* IP6 constants */
 
@@ -82,4 +83,11 @@ extern int add_ipv6_address ( struct net_device *netdev,
 			      struct in6_addr gateway );
 extern void del_ipv6_address ( struct net_device *netdev );
 
+extern int ipv6_tx ( struct io_buffer *iobuf,
+		     struct tcpip_protocol *tcpip,
+		     struct sockaddr_tcpip *st_src,
+		     struct sockaddr_tcpip *st_dest,
+		     struct net_device *netdev,
+		     uint16_t *trans_csum );
+
 #endif /* _GPXE_IP6_H */
diff --git a/src/net/icmpv6.c b/src/net/icmpv6.c
index dcc5851..f24b98b 100644
--- a/src/net/icmpv6.c
+++ b/src/net/icmpv6.c
@@ -63,8 +63,8 @@ int icmp6_send_solicit ( struct net_device *netdev, struct in6_addr *src __unuse
 	st_dest.sin6.sin6_addr.in6_u.u6_addr8[15] = 0x1;
 
 	/* Send packet over IP6 */
-	return tcpip_tx ( iobuf, &icmp6_protocol, NULL, &st_dest.st,
-			  netdev, &nsolicit->csum );
+	return ipv6_tx ( iobuf, &icmp6_protocol, NULL, &st_dest.st,
+			 netdev, &nsolicit->csum );
 }
 
 /**
@@ -105,8 +105,8 @@ int icmp6_send_rsolicit ( struct net_device *netdev ) {
 	st_dest.sin6.sin6_addr.in6_u.u6_addr8[15] = 0x2;
 
 	/* Send packet over IP6 */
-	return tcpip_tx ( iobuf, &icmp6_protocol, NULL, &st_dest.st,
-			  netdev, &solicit->csum );
+	return ipv6_tx ( iobuf, &icmp6_protocol, NULL, &st_dest.st,
+			 netdev, &solicit->csum );
 }
 
 /**
@@ -155,8 +155,8 @@ int icmp6_send_advert ( struct net_device *netdev, struct in6_addr *src,
 	st_dest.sin6.sin6_addr = *dest;
 
 	/* Send packet over IP6 */
-	return tcpip_tx ( iobuf, &icmp6_protocol, NULL, &st_dest.st,
-			  NULL, &nadvert->csum );
+	return ipv6_tx ( iobuf, &icmp6_protocol, NULL, &st_dest.st,
+			 NULL, &nadvert->csum );
 }
 
 /**
@@ -179,8 +179,8 @@ int icmp6_handle_echo ( struct io_buffer *iobuf, struct sockaddr_tcpip *st_src,
 	icmp6hdr->csum = tcpip_chksum ( icmp6hdr, len );
 
 	/* Transmit the response */
-	if ( ( rc = tcpip_tx ( iob_disown ( iobuf ), &icmp6_protocol, st_dest,
-			       st_src, NULL, &icmp6hdr->csum ) ) != 0 ) {
+	if ( ( rc = ipv6_tx ( iob_disown ( iobuf ), &icmp6_protocol, st_dest,
+			      st_src, NULL, &icmp6hdr->csum ) ) != 0 ) {
 		DBG ( "ICMP could not transmit ping response: %s\n",
 		      strerror ( rc ) );
 	}
diff --git a/src/net/ipv6.c b/src/net/ipv6.c
index 6e6fe3f..a58b5fc 100644
--- a/src/net/ipv6.c
+++ b/src/net/ipv6.c
@@ -245,12 +245,12 @@ void ipv6_dump ( struct ip6_header *ip6hdr ) {
  *
  * This function prepends the IPv6 headers to the payload an transmits it.
  */
-static int ipv6_tx ( struct io_buffer *iobuf,
-		     struct tcpip_protocol *tcpip,
-		     struct sockaddr_tcpip *st_src __unused,
-		     struct sockaddr_tcpip *st_dest,
-		     struct net_device *netdev,
-		     uint16_t *trans_csum ) {
+int ipv6_tx ( struct io_buffer *iobuf,
+	      struct tcpip_protocol *tcpip,
+	      struct sockaddr_tcpip *st_src __unused,
+	      struct sockaddr_tcpip *st_dest,
+	      struct net_device *netdev,
+	      uint16_t *trans_csum ) {
 	struct sockaddr_in6 *dest = ( struct sockaddr_in6* ) st_dest;
 	struct in6_addr next_hop, gateway = ip6_none;
 	struct ipv6_miniroute *miniroute;
-- 
1.7.2.5



More information about the gPXE-devel mailing list