ipv6: bit of style cleanup. No functional change
This commit is contained in:
@@ -73,6 +73,7 @@ struct IPv6Header {
|
||||
typedef DoublyLinkedList<struct net_buffer,
|
||||
DoublyLinkedListCLink<struct net_buffer> > FragmentList;
|
||||
|
||||
|
||||
// TODO: make common fragmentation interface for both address families
|
||||
struct ipv6_packet_key {
|
||||
in6_addr source;
|
||||
@@ -82,6 +83,7 @@ struct ipv6_packet_key {
|
||||
uint32 protocol;
|
||||
};
|
||||
|
||||
|
||||
class FragmentPacket {
|
||||
public:
|
||||
FragmentPacket(const ipv6_packet_key& key);
|
||||
@@ -142,6 +144,7 @@ struct FragmentHashDefinition {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
typedef BOpenHashTable<FragmentHashDefinition, false, true> FragmentTable;
|
||||
|
||||
|
||||
@@ -151,8 +154,8 @@ public:
|
||||
RawSocket(net_socket* socket);
|
||||
};
|
||||
|
||||
typedef DoublyLinkedList<RawSocket> RawSocketList;
|
||||
|
||||
typedef DoublyLinkedList<RawSocket> RawSocketList;
|
||||
|
||||
typedef MulticastGroupInterface<IPv6Multicast> IPv6GroupInterface;
|
||||
typedef MulticastFilter<IPv6Multicast> IPv6MulticastFilter;
|
||||
@@ -521,18 +524,21 @@ dump_ipv6_header(IPv6Header &header)
|
||||
|
||||
|
||||
/*! Attempts to re-assemble fragmented packets.
|
||||
\return B_OK if everything went well; if it could reassemble the packet, \a _buffer
|
||||
will point to its buffer, otherwise, it will be \c NULL.
|
||||
\return B_OK if everything went well; if it could reassemble the packet,
|
||||
\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)
|
||||
*/
|
||||
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;
|
||||
status_t status;
|
||||
|
||||
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)
|
||||
return status;
|
||||
|
||||
@@ -645,8 +651,8 @@ send_fragments(ipv6_protocol* protocol, struct net_route* route,
|
||||
bool lastFragment = bytesLeft == 0;
|
||||
|
||||
bufferHeader->header.ip6_nxt = IPPROTO_FRAGMENT;
|
||||
bufferHeader->header.ip6_plen =
|
||||
htons(fragmentLength + extensionHeadersLength);
|
||||
bufferHeader->header.ip6_plen
|
||||
= htons(fragmentLength + extensionHeadersLength);
|
||||
bufferHeader.Sync();
|
||||
|
||||
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)
|
||||
return B_BAD_ADDRESS;
|
||||
|
||||
return ipv6_delta_membership(protocol, option, mreq.ipv6mr_interface,
|
||||
&mreq.ipv6mr_multiaddr, NULL);
|
||||
return ipv6_delta_membership(protocol, option,
|
||||
mreq.ipv6mr_interface, &mreq.ipv6mr_multiaddr, NULL);
|
||||
}
|
||||
|
||||
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
|
||||
if (protocolNumber == IPPROTO_ICMPV6
|
||||
&& dataLength >= sizeof(struct icmp6_hdr)) {
|
||||
NetBufferField<uint16,
|
||||
sizeof(ip6_hdr) + offsetof(icmp6_hdr, icmp6_cksum)>
|
||||
NetBufferField<uint16, sizeof(ip6_hdr)
|
||||
+ offsetof(icmp6_hdr, icmp6_cksum)>
|
||||
icmpChecksum(buffer);
|
||||
// first make sure the existing checksum is zero
|
||||
*icmpChecksum = 0;
|
||||
@@ -1482,7 +1488,9 @@ ipv6_receive_data(net_buffer* buffer)
|
||||
return status;
|
||||
|
||||
// check for fragmentation
|
||||
uint16 fragmentHeaderOffset = header.GetHeaderOffset(buffer, IPPROTO_FRAGMENT);
|
||||
uint16 fragmentHeaderOffset
|
||||
= header.GetHeaderOffset(buffer, IPPROTO_FRAGMENT);
|
||||
|
||||
if (fragmentHeaderOffset != 0) {
|
||||
// this is 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)))
|
||||
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;
|
||||
|
||||
if (gBufferModule->stored_header_length(buffer)
|
||||
|
||||
Reference in New Issue
Block a user