ipv6: bit of style cleanup. No functional change
This commit is contained in:
@@ -73,6 +73,7 @@ struct IPv6Header {
|
|||||||
typedef DoublyLinkedList<struct net_buffer,
|
typedef DoublyLinkedList<struct net_buffer,
|
||||||
DoublyLinkedListCLink<struct net_buffer> > FragmentList;
|
DoublyLinkedListCLink<struct net_buffer> > FragmentList;
|
||||||
|
|
||||||
|
|
||||||
// TODO: make common fragmentation interface for both address families
|
// TODO: make common fragmentation interface for both address families
|
||||||
struct ipv6_packet_key {
|
struct ipv6_packet_key {
|
||||||
in6_addr source;
|
in6_addr source;
|
||||||
@@ -82,6 +83,7 @@ struct ipv6_packet_key {
|
|||||||
uint32 protocol;
|
uint32 protocol;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class FragmentPacket {
|
class FragmentPacket {
|
||||||
public:
|
public:
|
||||||
FragmentPacket(const ipv6_packet_key& key);
|
FragmentPacket(const ipv6_packet_key& key);
|
||||||
@@ -142,6 +144,7 @@ struct FragmentHashDefinition {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef BOpenHashTable<FragmentHashDefinition, false, true> FragmentTable;
|
typedef BOpenHashTable<FragmentHashDefinition, false, true> FragmentTable;
|
||||||
|
|
||||||
|
|
||||||
@@ -151,8 +154,8 @@ public:
|
|||||||
RawSocket(net_socket* socket);
|
RawSocket(net_socket* socket);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef DoublyLinkedList<RawSocket> RawSocketList;
|
|
||||||
|
|
||||||
|
typedef DoublyLinkedList<RawSocket> RawSocketList;
|
||||||
|
|
||||||
typedef MulticastGroupInterface<IPv6Multicast> IPv6GroupInterface;
|
typedef MulticastGroupInterface<IPv6Multicast> IPv6GroupInterface;
|
||||||
typedef MulticastFilter<IPv6Multicast> IPv6MulticastFilter;
|
typedef MulticastFilter<IPv6Multicast> IPv6MulticastFilter;
|
||||||
@@ -521,18 +524,21 @@ dump_ipv6_header(IPv6Header &header)
|
|||||||
|
|
||||||
|
|
||||||
/*! Attempts to re-assemble fragmented packets.
|
/*! Attempts to re-assemble fragmented packets.
|
||||||
\return B_OK if everything went well; if it could reassemble the packet, \a _buffer
|
\return B_OK if everything went well; if it could reassemble the packet,
|
||||||
will point to its buffer, otherwise, it will be \c NULL.
|
\a _buffer will point to its buffer, otherwise, it will be \c NULL.
|
||||||
\return various error codes if something went wrong (mostly B_NO_MEMORY)
|
\return various error codes if something went wrong (mostly B_NO_MEMORY)
|
||||||
*/
|
*/
|
||||||
static status_t
|
static status_t
|
||||||
reassemble_fragments(const IPv6Header &header, net_buffer** _buffer, uint16 offset)
|
reassemble_fragments(const IPv6Header &header, net_buffer** _buffer,
|
||||||
|
uint16 offset)
|
||||||
{
|
{
|
||||||
net_buffer* buffer = *_buffer;
|
net_buffer* buffer = *_buffer;
|
||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
ip6_frag fragmentHeader;
|
ip6_frag fragmentHeader;
|
||||||
status = gBufferModule->read(buffer, offset, &fragmentHeader, sizeof(ip6_frag));
|
status = gBufferModule->read(buffer, offset, &fragmentHeader,
|
||||||
|
sizeof(ip6_frag));
|
||||||
|
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
@@ -645,8 +651,8 @@ send_fragments(ipv6_protocol* protocol, struct net_route* route,
|
|||||||
bool lastFragment = bytesLeft == 0;
|
bool lastFragment = bytesLeft == 0;
|
||||||
|
|
||||||
bufferHeader->header.ip6_nxt = IPPROTO_FRAGMENT;
|
bufferHeader->header.ip6_nxt = IPPROTO_FRAGMENT;
|
||||||
bufferHeader->header.ip6_plen =
|
bufferHeader->header.ip6_plen
|
||||||
htons(fragmentLength + extensionHeadersLength);
|
= htons(fragmentLength + extensionHeadersLength);
|
||||||
bufferHeader.Sync();
|
bufferHeader.Sync();
|
||||||
|
|
||||||
ip6_frag fragmentHeader;
|
ip6_frag fragmentHeader;
|
||||||
@@ -1155,8 +1161,8 @@ ipv6_setsockopt(net_protocol* _protocol, int level, int option,
|
|||||||
if (user_memcpy(&mreq, value, sizeof(ipv6_mreq)) != B_OK)
|
if (user_memcpy(&mreq, value, sizeof(ipv6_mreq)) != B_OK)
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
|
|
||||||
return ipv6_delta_membership(protocol, option, mreq.ipv6mr_interface,
|
return ipv6_delta_membership(protocol, option,
|
||||||
&mreq.ipv6mr_multiaddr, NULL);
|
mreq.ipv6mr_interface, &mreq.ipv6mr_multiaddr, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("IPv6::setsockopt(): set unknown option: %d\n", option);
|
dprintf("IPv6::setsockopt(): set unknown option: %d\n", option);
|
||||||
@@ -1295,8 +1301,8 @@ ipv6_send_routed_data(net_protocol* _protocol, struct net_route* route,
|
|||||||
// write the checksum for ICMPv6 sockets
|
// write the checksum for ICMPv6 sockets
|
||||||
if (protocolNumber == IPPROTO_ICMPV6
|
if (protocolNumber == IPPROTO_ICMPV6
|
||||||
&& dataLength >= sizeof(struct icmp6_hdr)) {
|
&& dataLength >= sizeof(struct icmp6_hdr)) {
|
||||||
NetBufferField<uint16,
|
NetBufferField<uint16, sizeof(ip6_hdr)
|
||||||
sizeof(ip6_hdr) + offsetof(icmp6_hdr, icmp6_cksum)>
|
+ offsetof(icmp6_hdr, icmp6_cksum)>
|
||||||
icmpChecksum(buffer);
|
icmpChecksum(buffer);
|
||||||
// first make sure the existing checksum is zero
|
// first make sure the existing checksum is zero
|
||||||
*icmpChecksum = 0;
|
*icmpChecksum = 0;
|
||||||
@@ -1482,7 +1488,9 @@ ipv6_receive_data(net_buffer* buffer)
|
|||||||
return status;
|
return status;
|
||||||
|
|
||||||
// check for fragmentation
|
// check for fragmentation
|
||||||
uint16 fragmentHeaderOffset = header.GetHeaderOffset(buffer, IPPROTO_FRAGMENT);
|
uint16 fragmentHeaderOffset
|
||||||
|
= header.GetHeaderOffset(buffer, IPPROTO_FRAGMENT);
|
||||||
|
|
||||||
if (fragmentHeaderOffset != 0) {
|
if (fragmentHeaderOffset != 0) {
|
||||||
// this is a fragment
|
// this is a fragment
|
||||||
TRACE(" ipv6_receive_data(): Found a Fragment!");
|
TRACE(" ipv6_receive_data(): Found a Fragment!");
|
||||||
@@ -1565,7 +1573,7 @@ ipv6_process_ancillary_data_no_container(net_protocol* _protocol,
|
|||||||
if (msgControlLen < CMSG_SPACE(sizeof(int)))
|
if (msgControlLen < CMSG_SPACE(sizeof(int)))
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
// use some default value (64 at the moment) when extracting the real one fails
|
// use some default value (64 at the moment) when the real one fails
|
||||||
int hopLimit = IPV6_DEFHLIM;
|
int hopLimit = IPV6_DEFHLIM;
|
||||||
|
|
||||||
if (gBufferModule->stored_header_length(buffer)
|
if (gBufferModule->stored_header_length(buffer)
|
||||||
|
|||||||
Reference in New Issue
Block a user