[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>
This commit is contained in:
parent
33652880a7
commit
fec127cb07
@ -386,7 +386,7 @@ static int ipv6_tx ( struct io_buffer *iobuf,
|
|||||||
sizeof ( iphdr->src ) );
|
sizeof ( iphdr->src ) );
|
||||||
}
|
}
|
||||||
if ( ( ! IN6_IS_ADDR_MULTICAST ( next_hop ) ) &&
|
if ( ( ! IN6_IS_ADDR_MULTICAST ( next_hop ) ) &&
|
||||||
( ( miniroute = ipv6_route ( ntohl ( sin6_dest->sin6_scope_id ),
|
( ( miniroute = ipv6_route ( sin6_dest->sin6_scope_id,
|
||||||
&next_hop ) ) != NULL ) ) {
|
&next_hop ) ) != NULL ) ) {
|
||||||
memcpy ( &iphdr->src, &miniroute->address,
|
memcpy ( &iphdr->src, &miniroute->address,
|
||||||
sizeof ( iphdr->src ) );
|
sizeof ( iphdr->src ) );
|
||||||
@ -599,12 +599,12 @@ static int ipv6_rx ( struct io_buffer *iobuf, struct net_device *netdev,
|
|||||||
src.sin6.sin6_family = AF_INET6;
|
src.sin6.sin6_family = AF_INET6;
|
||||||
memcpy ( &src.sin6.sin6_addr, &iphdr->src,
|
memcpy ( &src.sin6.sin6_addr, &iphdr->src,
|
||||||
sizeof ( src.sin6.sin6_addr ) );
|
sizeof ( src.sin6.sin6_addr ) );
|
||||||
src.sin6.sin6_scope_id = htonl ( netdev->index );
|
src.sin6.sin6_scope_id = netdev->index;
|
||||||
memset ( &dest, 0, sizeof ( dest ) );
|
memset ( &dest, 0, sizeof ( dest ) );
|
||||||
dest.sin6.sin6_family = AF_INET6;
|
dest.sin6.sin6_family = AF_INET6;
|
||||||
memcpy ( &dest.sin6.sin6_addr, &iphdr->dest,
|
memcpy ( &dest.sin6.sin6_addr, &iphdr->dest,
|
||||||
sizeof ( dest.sin6.sin6_addr ) );
|
sizeof ( dest.sin6.sin6_addr ) );
|
||||||
dest.sin6.sin6_scope_id = htonl ( netdev->index );
|
dest.sin6.sin6_scope_id = netdev->index;
|
||||||
iob_pull ( iobuf, hdrlen );
|
iob_pull ( iobuf, hdrlen );
|
||||||
pshdr_csum = ipv6_pshdr_chksum ( iphdr, iob_len ( iobuf ),
|
pshdr_csum = ipv6_pshdr_chksum ( iphdr, iob_len ( iobuf ),
|
||||||
next_header, TCPIP_EMPTY_CSUM );
|
next_header, TCPIP_EMPTY_CSUM );
|
||||||
|
@ -119,12 +119,12 @@ static int ndp_tx_request ( struct net_device *netdev,
|
|||||||
sin6_src.sin6_family = AF_INET6;
|
sin6_src.sin6_family = AF_INET6;
|
||||||
memcpy ( &sin6_src.sin6_addr, net_source,
|
memcpy ( &sin6_src.sin6_addr, net_source,
|
||||||
sizeof ( sin6_src.sin6_addr ) );
|
sizeof ( sin6_src.sin6_addr ) );
|
||||||
sin6_src.sin6_scope_id = htons ( netdev->index );
|
sin6_src.sin6_scope_id = netdev->index;
|
||||||
|
|
||||||
/* Construct multicast destination address */
|
/* Construct multicast destination address */
|
||||||
memset ( &sin6_dest, 0, sizeof ( sin6_dest ) );
|
memset ( &sin6_dest, 0, sizeof ( sin6_dest ) );
|
||||||
sin6_dest.sin6_family = AF_INET6;
|
sin6_dest.sin6_family = AF_INET6;
|
||||||
sin6_dest.sin6_scope_id = htons ( netdev->index );
|
sin6_dest.sin6_scope_id = netdev->index;
|
||||||
ipv6_solicited_node ( &sin6_dest.sin6_addr, net_dest );
|
ipv6_solicited_node ( &sin6_dest.sin6_addr, net_dest );
|
||||||
|
|
||||||
/* Transmit neighbour discovery packet */
|
/* Transmit neighbour discovery packet */
|
||||||
|
Reference in New Issue
Block a user