Browse Source

[ipv6] Treat sin6_scope_id consistently

sin6_scope_id is never exposed outside of the local system, and so
should be a native-endian quantity.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
fec127cb07
2 changed files with 5 additions and 5 deletions
  1. 3
    3
      src/net/ipv6.c
  2. 2
    2
      src/net/ndp.c

+ 3
- 3
src/net/ipv6.c View File

386
 			 sizeof ( iphdr->src ) );
386
 			 sizeof ( iphdr->src ) );
387
 	}
387
 	}
388
 	if ( ( ! IN6_IS_ADDR_MULTICAST ( next_hop ) ) &&
388
 	if ( ( ! IN6_IS_ADDR_MULTICAST ( next_hop ) ) &&
389
-	     ( ( miniroute = ipv6_route ( ntohl ( sin6_dest->sin6_scope_id ),
389
+	     ( ( miniroute = ipv6_route ( sin6_dest->sin6_scope_id,
390
 					  &next_hop ) ) != NULL ) ) {
390
 					  &next_hop ) ) != NULL ) ) {
391
 		memcpy ( &iphdr->src, &miniroute->address,
391
 		memcpy ( &iphdr->src, &miniroute->address,
392
 			 sizeof ( iphdr->src ) );
392
 			 sizeof ( iphdr->src ) );
599
 	src.sin6.sin6_family = AF_INET6;
599
 	src.sin6.sin6_family = AF_INET6;
600
 	memcpy ( &src.sin6.sin6_addr, &iphdr->src,
600
 	memcpy ( &src.sin6.sin6_addr, &iphdr->src,
601
 		 sizeof ( src.sin6.sin6_addr ) );
601
 		 sizeof ( src.sin6.sin6_addr ) );
602
-	src.sin6.sin6_scope_id = htonl ( netdev->index );
602
+	src.sin6.sin6_scope_id = netdev->index;
603
 	memset ( &dest, 0, sizeof ( dest ) );
603
 	memset ( &dest, 0, sizeof ( dest ) );
604
 	dest.sin6.sin6_family = AF_INET6;
604
 	dest.sin6.sin6_family = AF_INET6;
605
 	memcpy ( &dest.sin6.sin6_addr, &iphdr->dest,
605
 	memcpy ( &dest.sin6.sin6_addr, &iphdr->dest,
606
 		 sizeof ( dest.sin6.sin6_addr ) );
606
 		 sizeof ( dest.sin6.sin6_addr ) );
607
-	dest.sin6.sin6_scope_id = htonl ( netdev->index );
607
+	dest.sin6.sin6_scope_id = netdev->index;
608
 	iob_pull ( iobuf, hdrlen );
608
 	iob_pull ( iobuf, hdrlen );
609
 	pshdr_csum = ipv6_pshdr_chksum ( iphdr, iob_len ( iobuf ),
609
 	pshdr_csum = ipv6_pshdr_chksum ( iphdr, iob_len ( iobuf ),
610
 					 next_header, TCPIP_EMPTY_CSUM );
610
 					 next_header, TCPIP_EMPTY_CSUM );

+ 2
- 2
src/net/ndp.c View File

119
 	sin6_src.sin6_family = AF_INET6;
119
 	sin6_src.sin6_family = AF_INET6;
120
 	memcpy ( &sin6_src.sin6_addr, net_source,
120
 	memcpy ( &sin6_src.sin6_addr, net_source,
121
 		 sizeof ( sin6_src.sin6_addr ) );
121
 		 sizeof ( sin6_src.sin6_addr ) );
122
-	sin6_src.sin6_scope_id = htons ( netdev->index );
122
+	sin6_src.sin6_scope_id = netdev->index;
123
 
123
 
124
 	/* Construct multicast destination address */
124
 	/* Construct multicast destination address */
125
 	memset ( &sin6_dest, 0, sizeof ( sin6_dest ) );
125
 	memset ( &sin6_dest, 0, sizeof ( sin6_dest ) );
126
 	sin6_dest.sin6_family = AF_INET6;
126
 	sin6_dest.sin6_family = AF_INET6;
127
-	sin6_dest.sin6_scope_id = htons ( netdev->index );
127
+	sin6_dest.sin6_scope_id = netdev->index;
128
 	ipv6_solicited_node ( &sin6_dest.sin6_addr, net_dest );
128
 	ipv6_solicited_node ( &sin6_dest.sin6_addr, net_dest );
129
 
129
 
130
 	/* Transmit neighbour discovery packet */
130
 	/* Transmit neighbour discovery packet */

Loading…
Cancel
Save