hrev47482 adds 1 changeset to branch 'master' old head: 17aa359b5df69f658b4b33e29546c9fb2f0cfce3 new head: 74e1a530f88029d2933619301c56f23bf31e96a1 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=74e1a53+%5E17aa359 ---------------------------------------------------------------------------- 74e1a53: Revert unrelated part of 17aa359b5df69f658b4b33e29546c9fb2f0cfce3. [ Jérôme Duval <jerome.duval@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev47482 Commit: 74e1a530f88029d2933619301c56f23bf31e96a1 URL: http://cgit.haiku-os.org/haiku/commit/?id=74e1a53 Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Fri Jul 11 20:23:21 2014 UTC ---------------------------------------------------------------------------- 3 files changed, 11 insertions(+), 85 deletions(-) build/jam/packages/Haiku | 4 +- headers/posix/netinet/in.h | 1 - src/add-ons/kernel/network/protocols/udp/udp.cpp | 91 ++------------------ ---------------------------------------------------------------------------- diff --git a/build/jam/packages/Haiku b/build/jam/packages/Haiku index c975bbb..72f52ab 100644 --- a/build/jam/packages/Haiku +++ b/build/jam/packages/Haiku @@ -38,7 +38,7 @@ if $(HAIKU_ATA_STACK) = 1 { AddFilesToPackage add-ons kernel busses random : virtio_rng ; AddFilesToPackage add-ons kernel busses scsi : ahci virtio_scsi ; -AddFilesToPackage add-ons kernel busses usb : <usb>uhci <usb>ohci <usb>ehci <usb>xhci ; +AddFilesToPackage add-ons kernel busses usb : <usb>uhci <usb>ohci <usb>ehci ; AddFilesToPackage add-ons kernel busses virtio : virtio_pci ; AddFilesToPackage add-ons kernel console : vga_text ; AddFilesToPackage add-ons kernel debugger @@ -206,7 +206,7 @@ AddBootModuleSymlinksToPackage openpic@ppc packagefs pci scsi scsi_cd scsi_disk scsi_periph silicon_image_3112 - usb usb_disk <usb>ehci <usb>ohci <usb>uhci <usb>xhci + usb usb_disk <usb>ehci <usb>ohci <usb>uhci virtio virtio_block virtio_pci virtio_scsi ; diff --git a/headers/posix/netinet/in.h b/headers/posix/netinet/in.h index 73a6bfc..ab891cb 100644 --- a/headers/posix/netinet/in.h +++ b/headers/posix/netinet/in.h @@ -64,7 +64,6 @@ typedef uint32_t in_addr_t; #define IPPROTO_NONE 59 /* 59, IPv6 no next header */ #define IPPROTO_DSTOPTS 60 /* 60, IPv6 destination option */ #define IPPROTO_ETHERIP 97 /* 97, Ethernet in IPv4 */ -#define IPPROTO_UDPLITE 136 /* 136, UDPLite */ #define IPPROTO_RAW 255 /* 255 */ #define IPPROTO_MAX 256 diff --git a/src/add-ons/kernel/network/protocols/udp/udp.cpp b/src/add-ons/kernel/network/protocols/udp/udp.cpp index d19474e..97926b1 100644 --- a/src/add-ons/kernel/network/protocols/udp/udp.cpp +++ b/src/add-ons/kernel/network/protocols/udp/udp.cpp @@ -223,12 +223,10 @@ public: status_t InitCheck() const; - status_t ReceiveData(net_buffer* buffer, - bool isUDPLite = false); + status_t ReceiveData(net_buffer* buffer); status_t ReceiveError(status_t error, net_buffer* buffer); - status_t Deframe(net_buffer* buffer, - bool isUDPLite = false); + status_t Deframe(net_buffer* buffer); UdpDomainSupport* OpenEndpoint(UdpEndpoint* endpoint); status_t FreeEndpoint(UdpDomainSupport* domain); @@ -694,7 +692,7 @@ UdpEndpointManager::DumpEndpoints(int argc, char *argv[]) status_t -UdpEndpointManager::ReceiveData(net_buffer *buffer, bool isUDPLite) +UdpEndpointManager::ReceiveData(net_buffer *buffer) { TRACE_EPM("ReceiveData(%p [%" B_PRIu32 " bytes])", buffer, buffer->size); @@ -705,7 +703,7 @@ UdpEndpointManager::ReceiveData(net_buffer *buffer, bool isUDPLite) return B_ERROR; } - status_t status = Deframe(buffer, isUDPLite); + status_t status = Deframe(buffer); if (status != B_OK) return status; @@ -761,7 +759,7 @@ UdpEndpointManager::ReceiveError(status_t error, net_buffer* buffer) status_t -UdpEndpointManager::Deframe(net_buffer* buffer, bool isUDPLite) +UdpEndpointManager::Deframe(net_buffer* buffer) { TRACE_EPM("Deframe(%p [%ld bytes])", buffer, buffer->size); @@ -788,33 +786,26 @@ UdpEndpointManager::Deframe(net_buffer* buffer, bool isUDPLite) TRACE_EPM(" Deframe(): data from %s to %s", source.AsString(true).Data(), destination.AsString(true).Data()); - bool liteCheck = isUDPLite; uint16 udpLength = ntohs(header.udp_length); - if (isUDPLite && udpLength == 0) { - udpLength = buffer->size; - liteCheck = false; - } if (udpLength > buffer->size) { TRACE_EPM(" Deframe(): buffer is too short, expected %hu.", udpLength); return B_MISMATCHED_VALUES; } - if (!isUDPLite && buffer->size > udpLength) + if (buffer->size > udpLength) gBufferModule->trim(buffer, udpLength); if (header.udp_checksum != 0) { // check UDP-checksum (simulating a so-called "pseudo-header"): uint16 sum = Checksum::PseudoHeader(addressModule, gBufferModule, - buffer, isUDPLite ? IPPROTO_UDPLITE : IPPROTO_UDP); + buffer, IPPROTO_UDP); if (sum != 0) { TRACE_EPM(" Deframe(): bad checksum 0x%hx.", sum); return B_BAD_VALUE; } } - // TODO check for udpLength < configured min length - bufferHeader.Remove(); // remove UDP-header from buffer before passing it on @@ -1000,7 +991,7 @@ UdpEndpoint::SendRoutedData(net_buffer *buffer, net_route *route) if (buffer->size > (0xffff - sizeof(udp_header))) return EMSGSIZE; - buffer->protocol = Socket()->protocol; + buffer->protocol = IPPROTO_UDP; // add and fill UDP-specific header: NetBufferPrepend<udp_header> header(buffer); @@ -1080,7 +1071,7 @@ UdpEndpoint::DeliverData(net_buffer *_buffer) if (buffer == NULL) return B_NO_MEMORY; - status_t status = sUdpEndpointManager->Deframe(buffer, Socket()->protocol); + status_t status = sUdpEndpointManager->Deframe(buffer); if (status < B_OK) { gBufferModule->free(buffer); return status; @@ -1120,21 +1111,6 @@ udp_init_protocol(net_socket *socket) } -net_protocol * -udplite_init_protocol(net_socket *socket) -{ - UdpEndpoint *endpoint = new (std::nothrow) UdpEndpoint(socket); - if (endpoint == NULL || endpoint->InitCheck() < B_OK) { - delete endpoint; - return NULL; - } - - socket->protocol = IPPROTO_UDPLITE; - - return endpoint; -} - - status_t udp_uninit_protocol(net_protocol *protocol) { @@ -1292,13 +1268,6 @@ udp_receive_data(net_buffer *buffer) status_t -udplite_receive_data(net_buffer *buffer) -{ - return sUdpEndpointManager->ReceiveData(buffer, true); -} - - -status_t udp_deliver_data(net_protocol *protocol, net_buffer *buffer) { return ((UdpEndpoint *)protocol)->DeliverData(buffer); @@ -1496,48 +1465,6 @@ net_protocol_module_info sUDPModule = { NULL // read_data_no_buffer() }; - -net_protocol_module_info sUDPLiteModule = { - { - "network/protocols/udplite/v1", - 0, - NULL - }, - NET_PROTOCOL_ATOMIC_MESSAGES, - - udplite_init_protocol, - udp_uninit_protocol, - udp_open, - udp_close, - udp_free, - udp_connect, - udp_accept, - udp_control, - udp_getsockopt, - udp_setsockopt, - udp_bind, - udp_unbind, - udp_listen, - udp_shutdown, - udp_send_data, - udp_send_routed_data, - udp_send_avail, - udp_read_data, - udp_read_avail, - udp_get_domain, - udp_get_mtu, - udplite_receive_data, - udp_deliver_data, - udp_error_received, - udp_error_reply, - NULL, // add_ancillary_data() - NULL, // process_ancillary_data() - udp_process_ancillary_data_no_container, - NULL, // send_data_no_buffer() - NULL // read_data_no_buffer() -}; - - module_dependency module_dependencies[] = { {NET_STACK_MODULE_NAME, (module_info **)&gStackModule}, {NET_BUFFER_MODULE_NAME, (module_info **)&gBufferModule},