* sockaddr_dl::sdl_e_type is now always stored in network order.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39777 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -208,7 +208,7 @@ ipv4_to_ether_multicast(sockaddr_dl *destination, const sockaddr_in *source)
|
|||||||
destination->sdl_family = AF_LINK;
|
destination->sdl_family = AF_LINK;
|
||||||
destination->sdl_index = 0;
|
destination->sdl_index = 0;
|
||||||
destination->sdl_type = IFT_ETHER;
|
destination->sdl_type = IFT_ETHER;
|
||||||
destination->sdl_e_type = ETHER_TYPE_IP;
|
destination->sdl_e_type = htons(ETHER_TYPE_IP);
|
||||||
destination->sdl_nlen = destination->sdl_slen = 0;
|
destination->sdl_nlen = destination->sdl_slen = 0;
|
||||||
destination->sdl_alen = ETHER_ADDRESS_LENGTH;
|
destination->sdl_alen = ETHER_ADDRESS_LENGTH;
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ arp_entry::Add(in_addr_t protocolAddress, sockaddr_dl *hardwareAddress,
|
|||||||
if (hardwareAddress != NULL) {
|
if (hardwareAddress != NULL) {
|
||||||
// this entry is already resolved
|
// this entry is already resolved
|
||||||
entry->hardware_address = *hardwareAddress;
|
entry->hardware_address = *hardwareAddress;
|
||||||
entry->hardware_address.sdl_e_type = ETHER_TYPE_IP;
|
entry->hardware_address.sdl_e_type = htons(ETHER_TYPE_IP);
|
||||||
} else {
|
} else {
|
||||||
// this entry still needs to be resolved
|
// this entry still needs to be resolved
|
||||||
entry->hardware_address.sdl_alen = 0;
|
entry->hardware_address.sdl_alen = 0;
|
||||||
@@ -459,7 +459,7 @@ arp_set_local_entry(arp_protocol* protocol, const sockaddr* local)
|
|||||||
address.sdl_len = sizeof(sockaddr_dl);
|
address.sdl_len = sizeof(sockaddr_dl);
|
||||||
address.sdl_family = AF_LINK;
|
address.sdl_family = AF_LINK;
|
||||||
address.sdl_type = IFT_ETHER;
|
address.sdl_type = IFT_ETHER;
|
||||||
address.sdl_e_type = ETHER_TYPE_IP;
|
address.sdl_e_type = htons(ETHER_TYPE_IP);
|
||||||
address.sdl_nlen = 0;
|
address.sdl_nlen = 0;
|
||||||
address.sdl_slen = 0;
|
address.sdl_slen = 0;
|
||||||
address.sdl_alen = interface->device->address.length;
|
address.sdl_alen = interface->device->address.length;
|
||||||
@@ -823,7 +823,7 @@ arp_start_resolve(arp_protocol* protocol, in_addr_t address, arp_entry** _entry)
|
|||||||
source.sdl_family = AF_LINK;
|
source.sdl_family = AF_LINK;
|
||||||
source.sdl_index = device->index;
|
source.sdl_index = device->index;
|
||||||
source.sdl_type = IFT_ETHER;
|
source.sdl_type = IFT_ETHER;
|
||||||
source.sdl_e_type = ETHER_TYPE_ARP;
|
source.sdl_e_type = htons(ETHER_TYPE_ARP);
|
||||||
source.sdl_nlen = source.sdl_slen = 0;
|
source.sdl_nlen = source.sdl_slen = 0;
|
||||||
source.sdl_alen = ETHER_ADDRESS_LENGTH;
|
source.sdl_alen = ETHER_ADDRESS_LENGTH;
|
||||||
memcpy(source.sdl_data, device->address.data, ETHER_ADDRESS_LENGTH);
|
memcpy(source.sdl_data, device->address.data, ETHER_ADDRESS_LENGTH);
|
||||||
@@ -862,7 +862,7 @@ arp_control(const char *subsystem, uint32 function, void *buffer,
|
|||||||
hardwareAddress.sdl_family = AF_LINK;
|
hardwareAddress.sdl_family = AF_LINK;
|
||||||
hardwareAddress.sdl_index = 0;
|
hardwareAddress.sdl_index = 0;
|
||||||
hardwareAddress.sdl_type = IFT_ETHER;
|
hardwareAddress.sdl_type = IFT_ETHER;
|
||||||
hardwareAddress.sdl_e_type = ETHER_TYPE_IP;
|
hardwareAddress.sdl_e_type = htons(ETHER_TYPE_IP);
|
||||||
hardwareAddress.sdl_nlen = hardwareAddress.sdl_slen = 0;
|
hardwareAddress.sdl_nlen = hardwareAddress.sdl_slen = 0;
|
||||||
hardwareAddress.sdl_alen = ETHER_ADDRESS_LENGTH;
|
hardwareAddress.sdl_alen = ETHER_ADDRESS_LENGTH;
|
||||||
memcpy(hardwareAddress.sdl_data, control.ethernet_address,
|
memcpy(hardwareAddress.sdl_data, control.ethernet_address,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ ethernet_deframe(net_device* device, net_buffer* buffer)
|
|||||||
source.sdl_family = AF_LINK;
|
source.sdl_family = AF_LINK;
|
||||||
source.sdl_index = device->index;
|
source.sdl_index = device->index;
|
||||||
source.sdl_type = IFT_ETHER;
|
source.sdl_type = IFT_ETHER;
|
||||||
source.sdl_e_type = type;
|
source.sdl_e_type = header.type;
|
||||||
source.sdl_nlen = source.sdl_slen = 0;
|
source.sdl_nlen = source.sdl_slen = 0;
|
||||||
source.sdl_alen = ETHER_ADDRESS_LENGTH;
|
source.sdl_alen = ETHER_ADDRESS_LENGTH;
|
||||||
memcpy(source.sdl_data, header.source, ETHER_ADDRESS_LENGTH);
|
memcpy(source.sdl_data, header.source, ETHER_ADDRESS_LENGTH);
|
||||||
@@ -61,7 +61,7 @@ ethernet_deframe(net_device* device, net_buffer* buffer)
|
|||||||
destination.sdl_family = AF_LINK;
|
destination.sdl_family = AF_LINK;
|
||||||
destination.sdl_index = device->index;
|
destination.sdl_index = device->index;
|
||||||
destination.sdl_type = IFT_ETHER;
|
destination.sdl_type = IFT_ETHER;
|
||||||
destination.sdl_e_type = type;
|
destination.sdl_e_type = header.type;
|
||||||
destination.sdl_nlen = destination.sdl_slen = 0;
|
destination.sdl_nlen = destination.sdl_slen = 0;
|
||||||
destination.sdl_alen = ETHER_ADDRESS_LENGTH;
|
destination.sdl_alen = ETHER_ADDRESS_LENGTH;
|
||||||
memcpy(destination.sdl_data, header.destination, ETHER_ADDRESS_LENGTH);
|
memcpy(destination.sdl_data, header.destination, ETHER_ADDRESS_LENGTH);
|
||||||
@@ -152,7 +152,7 @@ ethernet_frame_send_data(net_datalink_protocol* protocol, net_buffer* buffer)
|
|||||||
|
|
||||||
ether_header &header = bufferHeader.Data();
|
ether_header &header = bufferHeader.Data();
|
||||||
|
|
||||||
header.type = htons(source.sdl_e_type);
|
header.type = source.sdl_e_type;
|
||||||
memcpy(header.source, LLADDR(&source), ETHER_ADDRESS_LENGTH);
|
memcpy(header.source, LLADDR(&source), ETHER_ADDRESS_LENGTH);
|
||||||
if ((buffer->flags & MSG_BCAST) != 0)
|
if ((buffer->flags & MSG_BCAST) != 0)
|
||||||
memcpy(header.destination, kBroadcastAddress, ETHER_ADDRESS_LENGTH);
|
memcpy(header.destination, kBroadcastAddress, ETHER_ADDRESS_LENGTH);
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ ipv6_to_ether_multicast(sockaddr_dl* destination, const sockaddr_in6* source)
|
|||||||
destination->sdl_family = AF_LINK;
|
destination->sdl_family = AF_LINK;
|
||||||
destination->sdl_index = 0;
|
destination->sdl_index = 0;
|
||||||
destination->sdl_type = IFT_ETHER;
|
destination->sdl_type = IFT_ETHER;
|
||||||
destination->sdl_e_type = ETHER_TYPE_IPV6;
|
destination->sdl_e_type = htons(ETHER_TYPE_IPV6);
|
||||||
destination->sdl_nlen = destination->sdl_slen = 0;
|
destination->sdl_nlen = destination->sdl_slen = 0;
|
||||||
destination->sdl_alen = ETHER_ADDRESS_LENGTH;
|
destination->sdl_alen = ETHER_ADDRESS_LENGTH;
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ ndp_entry::Add(const in6_addr& protocolAddress, sockaddr_dl* hardwareAddress,
|
|||||||
if (hardwareAddress != NULL) {
|
if (hardwareAddress != NULL) {
|
||||||
// this entry is already resolved
|
// this entry is already resolved
|
||||||
entry->hardware_address = *hardwareAddress;
|
entry->hardware_address = *hardwareAddress;
|
||||||
entry->hardware_address.sdl_e_type = ETHER_TYPE_IPV6;
|
entry->hardware_address.sdl_e_type = htons(ETHER_TYPE_IPV6);
|
||||||
} else {
|
} else {
|
||||||
// this entry still needs to be resolved
|
// this entry still needs to be resolved
|
||||||
entry->hardware_address.sdl_alen = 0;
|
entry->hardware_address.sdl_alen = 0;
|
||||||
@@ -614,7 +614,7 @@ ndp_set_local_entry(ipv6_datalink_protocol* protocol, const sockaddr* local)
|
|||||||
address.sdl_len = sizeof(sockaddr_dl);
|
address.sdl_len = sizeof(sockaddr_dl);
|
||||||
address.sdl_family = AF_LINK;
|
address.sdl_family = AF_LINK;
|
||||||
address.sdl_type = IFT_ETHER;
|
address.sdl_type = IFT_ETHER;
|
||||||
address.sdl_e_type = ETHER_TYPE_IPV6;
|
address.sdl_e_type = htons(ETHER_TYPE_IPV6);
|
||||||
address.sdl_nlen = 0;
|
address.sdl_nlen = 0;
|
||||||
address.sdl_slen = 0;
|
address.sdl_slen = 0;
|
||||||
address.sdl_alen = interface->device->address.length;
|
address.sdl_alen = interface->device->address.length;
|
||||||
@@ -685,7 +685,7 @@ ndp_receive_solicitation(net_buffer* buffer, bool* reuseBuffer)
|
|||||||
hardwareAddress.sdl_family = AF_LINK;
|
hardwareAddress.sdl_family = AF_LINK;
|
||||||
hardwareAddress.sdl_index = 0;
|
hardwareAddress.sdl_index = 0;
|
||||||
hardwareAddress.sdl_type = IFT_ETHER;
|
hardwareAddress.sdl_type = IFT_ETHER;
|
||||||
hardwareAddress.sdl_e_type = ETHER_TYPE_IPV6;
|
hardwareAddress.sdl_e_type = htons(ETHER_TYPE_IPV6);
|
||||||
hardwareAddress.sdl_nlen = hardwareAddress.sdl_slen = 0;
|
hardwareAddress.sdl_nlen = hardwareAddress.sdl_slen = 0;
|
||||||
hardwareAddress.sdl_alen = ETHER_ADDRESS_LENGTH;
|
hardwareAddress.sdl_alen = ETHER_ADDRESS_LENGTH;
|
||||||
memcpy(LLADDR(&hardwareAddress), header.link_address,
|
memcpy(LLADDR(&hardwareAddress), header.link_address,
|
||||||
@@ -760,7 +760,7 @@ ndp_receive_advertisement(net_buffer* buffer)
|
|||||||
hardwareAddress.sdl_family = AF_LINK;
|
hardwareAddress.sdl_family = AF_LINK;
|
||||||
hardwareAddress.sdl_index = 0;
|
hardwareAddress.sdl_index = 0;
|
||||||
hardwareAddress.sdl_type = IFT_ETHER;
|
hardwareAddress.sdl_type = IFT_ETHER;
|
||||||
hardwareAddress.sdl_e_type = ETHER_TYPE_IPV6;
|
hardwareAddress.sdl_e_type = htons(ETHER_TYPE_IPV6);
|
||||||
hardwareAddress.sdl_nlen = hardwareAddress.sdl_slen = 0;
|
hardwareAddress.sdl_nlen = hardwareAddress.sdl_slen = 0;
|
||||||
hardwareAddress.sdl_alen = ETHER_ADDRESS_LENGTH;
|
hardwareAddress.sdl_alen = ETHER_ADDRESS_LENGTH;
|
||||||
memcpy(LLADDR(&hardwareAddress), header.link_address, ETHER_ADDRESS_LENGTH);
|
memcpy(LLADDR(&hardwareAddress), header.link_address, ETHER_ADDRESS_LENGTH);
|
||||||
|
|||||||
Reference in New Issue
Block a user