* Finished groundwork on ICMP by introducing a completely protocol agnostic
error mechanism. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37896 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef ICMP_H
|
|
||||||
#define ICMP_H
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: this will go private soon
|
|
||||||
|
|
||||||
|
|
||||||
// RFC 792
|
|
||||||
#define ICMP_TYPE_ECHO_REPLY 0
|
|
||||||
#define ICMP_TYPE_UNREACH 3
|
|
||||||
#define ICMP_TYPE_SOURCE_QUENCH 4
|
|
||||||
#define ICMP_TYPE_REDIRECT 5
|
|
||||||
#define ICMP_TYPE_ECHO_REQUEST 8
|
|
||||||
#define ICMP_TYPE_TIME_EXCEEDED 11
|
|
||||||
#define ICMP_TYPE_PARAM_PROBLEM 12
|
|
||||||
#define ICMP_TYPE_TIMESTAMP_REQUEST 13
|
|
||||||
#define ICMP_TYPE_TIMESTAMP_REPLY 14
|
|
||||||
#define ICMP_TYPE_INFO_REQUEST 15
|
|
||||||
#define ICMP_TYPE_INFO_REPLY 16
|
|
||||||
// RFC 950
|
|
||||||
#define ICMP_TYPE_ADDR_MASK_REQUEST 17
|
|
||||||
#define ICMP_TYPE_ADDR_MASK_REPLY 18
|
|
||||||
|
|
||||||
#define ICMP_CODE_TIMEEX_IN_TRANSIT 0
|
|
||||||
#define ICMP_CODE_TIMEEX_FRAG 1
|
|
||||||
#define ICMP_CODE_PARAM_PROBLEM 0
|
|
||||||
#define ICMP_CODE_SOURCE_QUENCH 0
|
|
||||||
#define ICMP_CODE_NET_UNREACH 0
|
|
||||||
#define ICMP_CODE_HOST_UNREACH 1
|
|
||||||
#define ICMP_CODE_PROTO_UNREACH 2
|
|
||||||
#define ICMP_CODE_PORT_UNREACH 3
|
|
||||||
#define ICMP_CODE_FRAG_NEEDED 4
|
|
||||||
#define ICMP_CODE_SOURCE_ROUTE_FAIL 5
|
|
||||||
#define ICMP_CODE_REDIRECT_NET 0
|
|
||||||
#define ICMP_CODE_REDIRECT_HOST 1
|
|
||||||
#define ICMP_CODE_REDIRECT_TOS_NET 2
|
|
||||||
#define ICMP_CODE_REDIRECT_TOS_HOST 3
|
|
||||||
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
icmp_decode(uint32 errorCode, uint8 &type, uint8 &code)
|
|
||||||
{
|
|
||||||
type = errorCode >> 8;
|
|
||||||
code = errorCode & 0x0FF;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline uint32
|
|
||||||
icmp_encode(uint8 type, uint8 code)
|
|
||||||
{
|
|
||||||
return ((uint32)type << 8) + code;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // ICMP_H
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
|
* Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef NET_PROTOCOL_H
|
#ifndef NET_PROTOCOL_H
|
||||||
@@ -10,84 +10,109 @@
|
|||||||
#include <net_socket.h>
|
#include <net_socket.h>
|
||||||
|
|
||||||
|
|
||||||
|
struct ancillary_data_container;
|
||||||
|
struct ancillary_data_header;
|
||||||
|
struct iovec;
|
||||||
|
typedef struct net_domain net_domain;
|
||||||
|
typedef struct net_route net_route;
|
||||||
|
|
||||||
|
|
||||||
// level flags to pass to control()
|
// level flags to pass to control()
|
||||||
#define LEVEL_SET_OPTION 0x10000000
|
#define LEVEL_SET_OPTION 0x10000000
|
||||||
#define LEVEL_GET_OPTION 0x20000000
|
#define LEVEL_GET_OPTION 0x20000000
|
||||||
#define LEVEL_DRIVER_IOCTL 0x0f000000
|
#define LEVEL_DRIVER_IOCTL 0x0f000000
|
||||||
#define LEVEL_MASK 0x0fffffff
|
#define LEVEL_MASK 0x0fffffff
|
||||||
|
|
||||||
struct ancillary_data_container;
|
// Error codes for error_received(), and error_reply()
|
||||||
struct ancillary_data_header;
|
enum net_error {
|
||||||
|
B_NET_ERROR_REDIRECT_HOST = 1,
|
||||||
|
B_NET_ERROR_UNREACH_NET,
|
||||||
|
B_NET_ERROR_UNREACH_HOST,
|
||||||
|
B_NET_ERROR_UNREACH_PROTOCOL,
|
||||||
|
B_NET_ERROR_UNREACH_PORT,
|
||||||
|
B_NET_ERROR_MESSAGE_SIZE,
|
||||||
|
B_NET_ERROR_TRANSIT_TIME_EXCEEDED,
|
||||||
|
B_NET_ERROR_REASSEMBLY_TIME_EXCEEDED,
|
||||||
|
B_NET_ERROR_PARAMETER_PROBLEM,
|
||||||
|
B_NET_ERROR_QUENCH,
|
||||||
|
};
|
||||||
|
|
||||||
struct iovec;
|
typedef union net_error_data {
|
||||||
|
struct sockaddr_storage gateway;
|
||||||
|
uint32 mtu;
|
||||||
|
uint32 error_offset;
|
||||||
|
} net_error_data;
|
||||||
|
|
||||||
typedef struct net_protocol {
|
typedef struct net_protocol {
|
||||||
struct net_protocol *next;
|
struct net_protocol* next;
|
||||||
struct net_protocol_module_info *module;
|
struct net_protocol_module_info* module;
|
||||||
net_socket *socket;
|
net_socket* socket;
|
||||||
} net_protocol;
|
} net_protocol;
|
||||||
|
|
||||||
|
|
||||||
// net_protocol_module_info::flags field
|
// net_protocol_module_info::flags field
|
||||||
#define NET_PROTOCOL_ATOMIC_MESSAGES 0x01
|
#define NET_PROTOCOL_ATOMIC_MESSAGES 0x01
|
||||||
|
|
||||||
|
|
||||||
struct net_protocol_module_info {
|
struct net_protocol_module_info {
|
||||||
module_info info;
|
module_info info;
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
|
|
||||||
net_protocol *(*init_protocol)(net_socket *socket);
|
net_protocol* (*init_protocol)(net_socket* socket);
|
||||||
status_t (*uninit_protocol)(net_protocol *self);
|
status_t (*uninit_protocol)(net_protocol* self);
|
||||||
|
|
||||||
status_t (*open)(net_protocol *self);
|
status_t (*open)(net_protocol* self);
|
||||||
status_t (*close)(net_protocol *self);
|
status_t (*close)(net_protocol* self);
|
||||||
status_t (*free)(net_protocol *self);
|
status_t (*free)(net_protocol* self);
|
||||||
|
|
||||||
status_t (*connect)(net_protocol *self, const struct sockaddr *address);
|
status_t (*connect)(net_protocol* self, const struct sockaddr* address);
|
||||||
status_t (*accept)(net_protocol *self, struct net_socket **_acceptedSocket);
|
status_t (*accept)(net_protocol* self, net_socket** _acceptedSocket);
|
||||||
status_t (*control)(net_protocol *self, int level, int option, void *value,
|
status_t (*control)(net_protocol* self, int level, int option,
|
||||||
size_t *_length);
|
void* value, size_t* _length);
|
||||||
status_t (*getsockopt)(net_protocol *self, int level, int option,
|
status_t (*getsockopt)(net_protocol* self, int level, int option,
|
||||||
void *value, int *_length);
|
void* value, int* _length);
|
||||||
status_t (*setsockopt)(net_protocol *self, int level, int option,
|
status_t (*setsockopt)(net_protocol* self, int level, int option,
|
||||||
const void *value, int length);
|
const void* value, int length);
|
||||||
|
|
||||||
status_t (*bind)(net_protocol *self, const struct sockaddr *address);
|
status_t (*bind)(net_protocol* self, const struct sockaddr* address);
|
||||||
status_t (*unbind)(net_protocol *self, struct sockaddr *address);
|
status_t (*unbind)(net_protocol* self, struct sockaddr* address);
|
||||||
status_t (*listen)(net_protocol *self, int count);
|
status_t (*listen)(net_protocol* self, int count);
|
||||||
status_t (*shutdown)(net_protocol *self, int direction);
|
status_t (*shutdown)(net_protocol* self, int direction);
|
||||||
|
|
||||||
status_t (*send_data)(net_protocol *self, net_buffer *buffer);
|
status_t (*send_data)(net_protocol* self, net_buffer* buffer);
|
||||||
status_t (*send_routed_data)(net_protocol *self,
|
status_t (*send_routed_data)(net_protocol* self, net_route* route,
|
||||||
struct net_route *route, net_buffer *buffer);
|
net_buffer* buffer);
|
||||||
ssize_t (*send_avail)(net_protocol *self);
|
ssize_t (*send_avail)(net_protocol* self);
|
||||||
|
|
||||||
status_t (*read_data)(net_protocol *self, size_t numBytes, uint32 flags,
|
status_t (*read_data)(net_protocol* self, size_t numBytes, uint32 flags,
|
||||||
net_buffer **_buffer);
|
net_buffer** _buffer);
|
||||||
ssize_t (*read_avail)(net_protocol *self);
|
ssize_t (*read_avail)(net_protocol* self);
|
||||||
|
|
||||||
struct net_domain *(*get_domain)(net_protocol *self);
|
net_domain* (*get_domain)(net_protocol* self);
|
||||||
size_t (*get_mtu)(net_protocol *self, const struct sockaddr *address);
|
size_t (*get_mtu)(net_protocol* self, const struct sockaddr* address);
|
||||||
|
|
||||||
status_t (*receive_data)(net_buffer *data);
|
status_t (*receive_data)(net_buffer* data);
|
||||||
status_t (*deliver_data)(net_protocol *protocol, net_buffer *data);
|
status_t (*deliver_data)(net_protocol* self, net_buffer* data);
|
||||||
|
|
||||||
status_t (*error_received)(uint32 code, net_buffer *data);
|
status_t (*error_received)(net_error error, net_buffer* data);
|
||||||
status_t (*error_reply)(net_protocol *self, net_buffer *causedError,
|
status_t (*error_reply)(net_protocol* self, net_buffer* cause,
|
||||||
uint32 code, void *errorData);
|
net_error error, net_error_data* errorData);
|
||||||
|
|
||||||
status_t (*add_ancillary_data)(net_protocol *self,
|
status_t (*add_ancillary_data)(net_protocol* self,
|
||||||
ancillary_data_container *container, const cmsghdr *header);
|
ancillary_data_container* container, const cmsghdr* header);
|
||||||
ssize_t (*process_ancillary_data)(net_protocol *self,
|
ssize_t (*process_ancillary_data)(net_protocol* self,
|
||||||
const ancillary_data_header *header, const void *data,
|
const ancillary_data_header* header, const void* data,
|
||||||
void *buffer, size_t bufferSize);
|
void* buffer, size_t bufferSize);
|
||||||
ssize_t (*process_ancillary_data_no_container)(net_protocol *self,
|
ssize_t (*process_ancillary_data_no_container)(net_protocol* self,
|
||||||
net_buffer *buffer, void *data, size_t bufferSize);
|
net_buffer* buffer, void* data, size_t bufferSize);
|
||||||
|
|
||||||
ssize_t (*send_data_no_buffer)(net_protocol *self, const iovec *vecs,
|
ssize_t (*send_data_no_buffer)(net_protocol* self, const iovec* vecs,
|
||||||
size_t vecCount, ancillary_data_container *ancillaryData,
|
size_t vecCount, ancillary_data_container* ancillaryData,
|
||||||
const struct sockaddr *address, socklen_t addressLength);
|
const struct sockaddr* address, socklen_t addressLength);
|
||||||
ssize_t (*read_data_no_buffer)(net_protocol *self, const iovec *vecs,
|
ssize_t (*read_data_no_buffer)(net_protocol* self, const iovec* vecs,
|
||||||
size_t vecCount, ancillary_data_container **_ancillaryData,
|
size_t vecCount, ancillary_data_container** _ancillaryData,
|
||||||
struct sockaddr *_address, socklen_t *_addressLength);
|
struct sockaddr* _address, socklen_t* _addressLength);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // NET_PROTOCOL_H
|
#endif // NET_PROTOCOL_H
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "icmp.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <new>
|
#include <new>
|
||||||
@@ -21,7 +23,6 @@
|
|||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
#include <icmp.h>
|
|
||||||
#include <net_datalink.h>
|
#include <net_datalink.h>
|
||||||
#include <net_protocol.h>
|
#include <net_protocol.h>
|
||||||
#include <net_stack.h>
|
#include <net_stack.h>
|
||||||
@@ -55,11 +56,10 @@ struct icmp_header {
|
|||||||
uint16 _reserved;
|
uint16 _reserved;
|
||||||
uint16 next_mtu;
|
uint16 next_mtu;
|
||||||
} path_mtu;
|
} path_mtu;
|
||||||
uint32 gateway;
|
|
||||||
struct {
|
struct {
|
||||||
uint16 unused;
|
uint8 pointer;
|
||||||
uint16 mtu;
|
uint8 _reserved[3];
|
||||||
} frag;
|
} parameter_problem;
|
||||||
|
|
||||||
uint32 zero;
|
uint32 zero;
|
||||||
};
|
};
|
||||||
@@ -82,6 +82,34 @@ net_buffer_module_info* gBufferModule;
|
|||||||
static net_stack_module_info* sStackModule;
|
static net_stack_module_info* sStackModule;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef TRACE_ICMP
|
||||||
|
|
||||||
|
|
||||||
|
static const char*
|
||||||
|
net_error_to_string(net_error error)
|
||||||
|
{
|
||||||
|
#define CODE(x) case x: return #x;
|
||||||
|
switch (error) {
|
||||||
|
CODE(B_NET_ERROR_REDIRECT_HOST)
|
||||||
|
CODE(B_NET_ERROR_UNREACH_NET)
|
||||||
|
CODE(B_NET_ERROR_UNREACH_HOST)
|
||||||
|
CODE(B_NET_ERROR_UNREACH_PROTOCOL)
|
||||||
|
CODE(B_NET_ERROR_UNREACH_PORT)
|
||||||
|
CODE(B_NET_ERROR_MESSAGE_SIZE)
|
||||||
|
CODE(B_NET_ERROR_TRANSIT_TIME_EXCEEDED)
|
||||||
|
CODE(B_NET_ERROR_REASSEMBLY_TIME_EXCEEDED)
|
||||||
|
CODE(B_NET_ERROR_PARAMETER_PROBLEM)
|
||||||
|
CODE(B_NET_ERROR_QUENCH)
|
||||||
|
default:
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
#undef CODE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // TRACE_ICMP
|
||||||
|
|
||||||
|
|
||||||
static net_domain*
|
static net_domain*
|
||||||
get_domain(struct net_buffer* buffer)
|
get_domain(struct net_buffer* buffer)
|
||||||
{
|
{
|
||||||
@@ -112,13 +140,113 @@ static bool
|
|||||||
is_icmp_error(uint8 type)
|
is_icmp_error(uint8 type)
|
||||||
{
|
{
|
||||||
return type == ICMP_TYPE_UNREACH
|
return type == ICMP_TYPE_UNREACH
|
||||||
|| type == ICMP_TYPE_PARAM_PROBLEM
|
|| type == ICMP_TYPE_PARAMETER_PROBLEM
|
||||||
|| type == ICMP_TYPE_REDIRECT
|
|| type == ICMP_TYPE_REDIRECT
|
||||||
|| type == ICMP_TYPE_TIME_EXCEEDED
|
|| type == ICMP_TYPE_TIME_EXCEEDED
|
||||||
|| type == ICMP_TYPE_SOURCE_QUENCH;
|
|| type == ICMP_TYPE_SOURCE_QUENCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static net_error
|
||||||
|
icmp_to_net_error(uint8 type, uint8 code)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case ICMP_TYPE_UNREACH:
|
||||||
|
switch (code) {
|
||||||
|
case ICMP_CODE_FRAGMENTATION_NEEDED:
|
||||||
|
return B_NET_ERROR_MESSAGE_SIZE;
|
||||||
|
case ICMP_CODE_NET_UNREACH:
|
||||||
|
return B_NET_ERROR_UNREACH_NET;
|
||||||
|
case ICMP_CODE_HOST_UNREACH:
|
||||||
|
return B_NET_ERROR_UNREACH_HOST;
|
||||||
|
case ICMP_CODE_PROTOCOL_UNREACH:
|
||||||
|
return B_NET_ERROR_UNREACH_PROTOCOL;
|
||||||
|
case ICMP_CODE_PORT_UNREACH:
|
||||||
|
return B_NET_ERROR_UNREACH_PORT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ICMP_TYPE_PARAMETER_PROBLEM:
|
||||||
|
return B_NET_ERROR_PARAMETER_PROBLEM;
|
||||||
|
|
||||||
|
case ICMP_TYPE_REDIRECT:
|
||||||
|
return B_NET_ERROR_REDIRECT_HOST;
|
||||||
|
|
||||||
|
case ICMP_TYPE_SOURCE_QUENCH:
|
||||||
|
return B_NET_ERROR_QUENCH;
|
||||||
|
|
||||||
|
case ICMP_TYPE_TIME_EXCEEDED:
|
||||||
|
switch (code) {
|
||||||
|
case ICMP_CODE_TIME_EXCEEDED_IN_TRANSIT:
|
||||||
|
return B_NET_ERROR_TRANSIT_TIME_EXCEEDED;
|
||||||
|
case ICMP_CODE_REASSEMBLY_TIME_EXCEEDED:
|
||||||
|
return B_NET_ERROR_REASSEMBLY_TIME_EXCEEDED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (net_error)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
net_error_to_icmp(net_error error, uint8& type, uint8& code)
|
||||||
|
{
|
||||||
|
switch (error) {
|
||||||
|
// redirect
|
||||||
|
case B_NET_ERROR_REDIRECT_HOST:
|
||||||
|
type = ICMP_TYPE_REDIRECT;
|
||||||
|
code = ICMP_CODE_REDIRECT_HOST;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// unreach
|
||||||
|
case B_NET_ERROR_UNREACH_NET:
|
||||||
|
type = ICMP_TYPE_UNREACH;
|
||||||
|
code = ICMP_CODE_NET_UNREACH;
|
||||||
|
break;
|
||||||
|
case B_NET_ERROR_UNREACH_HOST:
|
||||||
|
type = ICMP_TYPE_UNREACH;
|
||||||
|
code = ICMP_CODE_HOST_UNREACH;
|
||||||
|
break;
|
||||||
|
case B_NET_ERROR_UNREACH_PROTOCOL:
|
||||||
|
type = ICMP_TYPE_UNREACH;
|
||||||
|
code = ICMP_CODE_PROTOCOL_UNREACH;
|
||||||
|
break;
|
||||||
|
case B_NET_ERROR_UNREACH_PORT:
|
||||||
|
type = ICMP_TYPE_UNREACH;
|
||||||
|
code = ICMP_CODE_PORT_UNREACH;
|
||||||
|
break;
|
||||||
|
case B_NET_ERROR_MESSAGE_SIZE:
|
||||||
|
type = ICMP_TYPE_UNREACH;
|
||||||
|
code = ICMP_CODE_FRAGMENTATION_NEEDED;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// time exceeded
|
||||||
|
case B_NET_ERROR_TRANSIT_TIME_EXCEEDED:
|
||||||
|
type = ICMP_TYPE_TIME_EXCEEDED;
|
||||||
|
code = ICMP_CODE_TIME_EXCEEDED_IN_TRANSIT;
|
||||||
|
break;
|
||||||
|
case B_NET_ERROR_REASSEMBLY_TIME_EXCEEDED:
|
||||||
|
type = ICMP_TYPE_TIME_EXCEEDED;
|
||||||
|
code = ICMP_CODE_REASSEMBLY_TIME_EXCEEDED;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// other
|
||||||
|
case B_NET_ERROR_PARAMETER_PROBLEM:
|
||||||
|
type = ICMP_TYPE_PARAMETER_PROBLEM;
|
||||||
|
code = 0;
|
||||||
|
break;
|
||||||
|
case B_NET_ERROR_QUENCH:
|
||||||
|
type = ICMP_TYPE_SOURCE_QUENCH;
|
||||||
|
code = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - module API
|
// #pragma mark - module API
|
||||||
|
|
||||||
|
|
||||||
@@ -353,17 +481,17 @@ icmp_receive_data(net_buffer* buffer)
|
|||||||
|
|
||||||
case ICMP_TYPE_UNREACH:
|
case ICMP_TYPE_UNREACH:
|
||||||
case ICMP_TYPE_SOURCE_QUENCH:
|
case ICMP_TYPE_SOURCE_QUENCH:
|
||||||
case ICMP_TYPE_PARAM_PROBLEM:
|
case ICMP_TYPE_PARAMETER_PROBLEM:
|
||||||
case ICMP_TYPE_TIME_EXCEEDED:
|
case ICMP_TYPE_TIME_EXCEEDED:
|
||||||
{
|
{
|
||||||
net_domain* domain = get_domain(buffer);
|
net_domain* domain = get_domain(buffer);
|
||||||
if (domain == NULL)
|
if (domain == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
uint32 error = icmp_encode(header.type, header.code);
|
// Deliver the error to the domain protocol which will
|
||||||
if (error > 0) {
|
// propagate the error to the upper protocols
|
||||||
// Deliver the error to the domain protocol which will
|
net_error error = icmp_to_net_error(header.type, header.code);
|
||||||
// propagate the error to the upper protocols
|
if (error != 0) {
|
||||||
bufferHeader.Remove();
|
bufferHeader.Remove();
|
||||||
return domain->module->error_received(error, buffer);
|
return domain->module->error_received(error, buffer);
|
||||||
}
|
}
|
||||||
@@ -390,7 +518,7 @@ icmp_receive_data(net_buffer* buffer)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
icmp_error_received(uint32 code, net_buffer* data)
|
icmp_error_received(net_error code, net_buffer* data)
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -400,13 +528,14 @@ icmp_error_received(uint32 code, net_buffer* data)
|
|||||||
error.
|
error.
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
icmp_error_reply(net_protocol* protocol, net_buffer* buffer, uint32 code,
|
icmp_error_reply(net_protocol* protocol, net_buffer* buffer, net_error error,
|
||||||
void* errorData)
|
net_error_data* errorData)
|
||||||
{
|
{
|
||||||
TRACE("icmp_error_reply(code %#" B_PRIx32 ")\n", code);
|
TRACE("icmp_error_reply(code %s)\n", net_error_to_string(error));
|
||||||
|
|
||||||
uint8 icmpType, icmpCode;
|
uint8 icmpType, icmpCode;
|
||||||
icmp_decode(code, icmpType, icmpCode);
|
net_error_to_icmp(error, icmpType, icmpCode);
|
||||||
|
|
||||||
TRACE(" icmp type %u, code %u\n", icmpType, icmpCode);
|
TRACE(" icmp type %u, code %u\n", icmpType, icmpCode);
|
||||||
|
|
||||||
ipv4_header header;
|
ipv4_header header;
|
||||||
@@ -452,11 +581,33 @@ icmp_error_reply(net_protocol* protocol, net_buffer* buffer, uint32 code,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now prepare the ICMP header
|
// Now prepare the ICMP header
|
||||||
|
|
||||||
NetBufferPrepend<icmp_header> icmpHeader(reply);
|
NetBufferPrepend<icmp_header> icmpHeader(reply);
|
||||||
icmpHeader->type = icmpType;
|
icmpHeader->type = icmpType;
|
||||||
icmpHeader->code = icmpCode;
|
icmpHeader->code = icmpCode;
|
||||||
icmpHeader->gateway = errorData ? *((uint32*)errorData) : 0;
|
icmpHeader->zero = 0;
|
||||||
icmpHeader->checksum = 0;
|
icmpHeader->checksum = 0;
|
||||||
|
|
||||||
|
if (errorData != NULL) {
|
||||||
|
switch (error) {
|
||||||
|
case B_NET_ERROR_REDIRECT_HOST:
|
||||||
|
{
|
||||||
|
sockaddr_in& gateway = (sockaddr_in&)errorData->gateway;
|
||||||
|
icmpHeader->redirect.gateway = gateway.sin_addr.s_addr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case B_NET_ERROR_PARAMETER_PROBLEM:
|
||||||
|
icmpHeader->parameter_problem.pointer = errorData->error_offset;
|
||||||
|
break;
|
||||||
|
case B_NET_ERROR_MESSAGE_SIZE:
|
||||||
|
icmpHeader->path_mtu.next_mtu = errorData->mtu;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
icmpHeader.Sync();
|
icmpHeader.Sync();
|
||||||
|
|
||||||
// Append IP header + 8 byte of the original datagram
|
// Append IP header + 8 byte of the original datagram
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef ICMP_H
|
||||||
|
#define ICMP_H
|
||||||
|
|
||||||
|
|
||||||
|
// ICMP types
|
||||||
|
|
||||||
|
// RFC 792
|
||||||
|
#define ICMP_TYPE_ECHO_REPLY 0
|
||||||
|
#define ICMP_TYPE_UNREACH 3
|
||||||
|
#define ICMP_TYPE_SOURCE_QUENCH 4
|
||||||
|
#define ICMP_TYPE_REDIRECT 5
|
||||||
|
#define ICMP_TYPE_ECHO_REQUEST 8
|
||||||
|
#define ICMP_TYPE_TIME_EXCEEDED 11
|
||||||
|
#define ICMP_TYPE_PARAMETER_PROBLEM 12
|
||||||
|
#define ICMP_TYPE_TIMESTAMP_REQUEST 13
|
||||||
|
#define ICMP_TYPE_TIMESTAMP_REPLY 14
|
||||||
|
#define ICMP_TYPE_INFO_REQUEST 15
|
||||||
|
#define ICMP_TYPE_INFO_REPLY 16
|
||||||
|
// RFC 950
|
||||||
|
#define ICMP_TYPE_ADDR_MASK_REQUEST 17
|
||||||
|
#define ICMP_TYPE_ADDR_MASK_REPLY 18
|
||||||
|
|
||||||
|
|
||||||
|
// ICMP codes
|
||||||
|
|
||||||
|
// ICMP_TYPE_TIME_EXCEEDED codes
|
||||||
|
#define ICMP_CODE_TIME_EXCEEDED_IN_TRANSIT 0
|
||||||
|
#define ICMP_CODE_REASSEMBLY_TIME_EXCEEDED 1
|
||||||
|
|
||||||
|
// ICMP_TYPE_PARAMETER_PROBLEM codes
|
||||||
|
#define ICMP_CODE_INVALID_PARAMETER 0
|
||||||
|
#define ICMP_CODE_PARAMETER_MISSING 1
|
||||||
|
|
||||||
|
// ICMP_TYPE_UNREACH codes
|
||||||
|
#define ICMP_CODE_NET_UNREACH 0
|
||||||
|
#define ICMP_CODE_HOST_UNREACH 1
|
||||||
|
#define ICMP_CODE_PROTOCOL_UNREACH 2
|
||||||
|
#define ICMP_CODE_PORT_UNREACH 3
|
||||||
|
#define ICMP_CODE_FRAGMENTATION_NEEDED 4
|
||||||
|
#define ICMP_CODE_SOURCE_ROUTE_FAIL 5
|
||||||
|
|
||||||
|
// ICMP_TYPE_REDIRECT codes
|
||||||
|
#define ICMP_CODE_REDIRECT_NET 0
|
||||||
|
#define ICMP_CODE_REDIRECT_HOST 1
|
||||||
|
#define ICMP_CODE_REDIRECT_TOS_NET 2
|
||||||
|
#define ICMP_CODE_REDIRECT_TOS_HOST 3
|
||||||
|
|
||||||
|
|
||||||
|
#endif // ICMP_H
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "ipv4_address.h"
|
#include "ipv4_address.h"
|
||||||
#include "multicast.h"
|
#include "multicast.h"
|
||||||
|
|
||||||
#include <icmp.h>
|
|
||||||
#include <net_datalink.h>
|
#include <net_datalink.h>
|
||||||
#include <net_datalink_protocol.h>
|
#include <net_datalink_protocol.h>
|
||||||
#include <net_device.h>
|
#include <net_device.h>
|
||||||
@@ -430,7 +429,7 @@ FragmentPacket::StaleTimer(struct net_timer* timer, void* data)
|
|||||||
if (!packet->fFragments.IsEmpty()) {
|
if (!packet->fFragments.IsEmpty()) {
|
||||||
// Send error: fragment reassembly time exceeded
|
// Send error: fragment reassembly time exceeded
|
||||||
sDomain->module->error_reply(NULL, packet->fFragments.First(),
|
sDomain->module->error_reply(NULL, packet->fFragments.First(),
|
||||||
icmp_encode(ICMP_TYPE_TIME_EXCEEDED, ICMP_CODE_TIMEEX_FRAG), NULL);
|
B_NET_ERROR_REASSEMBLY_TIME_EXCEEDED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete packet;
|
delete packet;
|
||||||
@@ -1602,8 +1601,8 @@ ipv4_receive_data(net_buffer* buffer)
|
|||||||
ntohl(header.source), ntohl(header.destination));
|
ntohl(header.source), ntohl(header.destination));
|
||||||
|
|
||||||
// Send ICMP error: Host unreachable
|
// Send ICMP error: Host unreachable
|
||||||
sDomain->module->error_reply(NULL, buffer,
|
sDomain->module->error_reply(NULL, buffer, B_NET_ERROR_UNREACH_HOST,
|
||||||
icmp_encode(ICMP_TYPE_UNREACH, ICMP_CODE_HOST_UNREACH), NULL);
|
NULL);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1658,7 +1657,7 @@ ipv4_receive_data(net_buffer* buffer)
|
|||||||
// no handler for this packet
|
// no handler for this packet
|
||||||
if (!rawDelivered) {
|
if (!rawDelivered) {
|
||||||
sDomain->module->error_reply(NULL, buffer,
|
sDomain->module->error_reply(NULL, buffer,
|
||||||
icmp_encode(ICMP_TYPE_UNREACH, ICMP_CODE_PROTO_UNREACH), NULL);
|
B_NET_ERROR_UNREACH_PROTOCOL, NULL);
|
||||||
}
|
}
|
||||||
return EAFNOSUPPORT;
|
return EAFNOSUPPORT;
|
||||||
}
|
}
|
||||||
@@ -1690,10 +1689,10 @@ ipv4_deliver_data(net_protocol* _protocol, net_buffer* buffer)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ipv4_error_received(uint32 code, net_buffer* buffer)
|
ipv4_error_received(net_error error, net_buffer* buffer)
|
||||||
{
|
{
|
||||||
TRACE(" ipv4_error_received(code %" B_PRIx32 ", buffer %p [%zu bytes])",
|
TRACE(" ipv4_error_received(code %" B_PRIx32 ", buffer %p [%zu bytes])",
|
||||||
code, buffer, buffer->size);
|
error, buffer, buffer->size);
|
||||||
|
|
||||||
NetBufferHeaderReader<ipv4_header> bufferHeader(buffer);
|
NetBufferHeaderReader<ipv4_header> bufferHeader(buffer);
|
||||||
if (bufferHeader.Status() != B_OK)
|
if (bufferHeader.Status() != B_OK)
|
||||||
@@ -1741,20 +1740,20 @@ ipv4_error_received(uint32 code, net_buffer* buffer)
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
// propagate error
|
// propagate error
|
||||||
return protocol->error_received(code, buffer);
|
return protocol->error_received(error, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ipv4_error_reply(net_protocol* protocol, net_buffer* causedError, uint32 code,
|
ipv4_error_reply(net_protocol* protocol, net_buffer* cause, net_error error,
|
||||||
void* errorData)
|
net_error_data* errorData)
|
||||||
{
|
{
|
||||||
// Directly obtain the ICMP protocol module
|
// Directly obtain the ICMP protocol module
|
||||||
net_protocol_module_info* icmp = receiving_protocol(IPPROTO_ICMP);
|
net_protocol_module_info* icmp = receiving_protocol(IPPROTO_ICMP);
|
||||||
if (icmp == NULL)
|
if (icmp == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
return icmp->error_reply(protocol, causedError, code, errorData);
|
return icmp->error_reply(protocol, cause, error, errorData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1020,15 +1020,15 @@ ipv6_deliver_data(net_protocol* _protocol, net_buffer* buffer)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ipv6_error(uint32 code, net_buffer* data)
|
ipv6_error_received(net_error error, net_buffer* data)
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ipv6_error_reply(net_protocol* protocol, net_buffer* causedError, uint32 code,
|
ipv6_error_reply(net_protocol* protocol, net_buffer* cause, net_error error,
|
||||||
void* errorData)
|
net_error_data* errorData)
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -1219,7 +1219,7 @@ net_protocol_module_info gIPv6Module = {
|
|||||||
ipv6_get_mtu,
|
ipv6_get_mtu,
|
||||||
ipv6_receive_data,
|
ipv6_receive_data,
|
||||||
ipv6_deliver_data,
|
ipv6_deliver_data,
|
||||||
ipv6_error,
|
ipv6_error_received,
|
||||||
ipv6_error_reply,
|
ipv6_error_reply,
|
||||||
NULL, // add_ancillary_data()
|
NULL, // add_ancillary_data()
|
||||||
NULL, // process_ancillary_data()
|
NULL, // process_ancillary_data()
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <net_datalink.h>
|
#include <net_datalink.h>
|
||||||
#include <net_protocol.h>
|
#include <net_protocol.h>
|
||||||
#include <net_stack.h>
|
#include <net_stack.h>
|
||||||
@@ -39,6 +40,7 @@
|
|||||||
#include <bluetooth/HCI/btHCI_acl.h>
|
#include <bluetooth/HCI/btHCI_acl.h>
|
||||||
#include <btModules.h>
|
#include <btModules.h>
|
||||||
|
|
||||||
|
|
||||||
#define BT_DEBUG_THIS_MODULE
|
#define BT_DEBUG_THIS_MODULE
|
||||||
#define SUBMODULE_NAME "L2cap"
|
#define SUBMODULE_NAME "L2cap"
|
||||||
#define SUBMODULE_COLOR 32
|
#define SUBMODULE_COLOR 32
|
||||||
@@ -281,7 +283,8 @@ status_t
|
|||||||
l2cap_receive_data(net_buffer* buffer)
|
l2cap_receive_data(net_buffer* buffer)
|
||||||
{
|
{
|
||||||
HciConnection* conn = (HciConnection*)buffer;
|
HciConnection* conn = (HciConnection*)buffer;
|
||||||
debugf("received some data, buffer length %lu\n", conn->currentRxPacket->size);
|
debugf("received some data, buffer length %lu\n",
|
||||||
|
conn->currentRxPacket->size);
|
||||||
|
|
||||||
l2cap_receive(conn, conn->currentRxPacket);
|
l2cap_receive(conn, conn->currentRxPacket);
|
||||||
|
|
||||||
@@ -290,7 +293,7 @@ l2cap_receive_data(net_buffer* buffer)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
l2cap_error(uint32 code, net_buffer* data)
|
l2cap_error_received(net_error error, net_buffer* data)
|
||||||
{
|
{
|
||||||
flowf("\n");
|
flowf("\n");
|
||||||
|
|
||||||
@@ -299,8 +302,8 @@ l2cap_error(uint32 code, net_buffer* data)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
l2cap_error_reply(net_protocol* protocol, net_buffer* causedError, uint32 code,
|
l2cap_error_reply(net_protocol* protocol, net_buffer* cause, net_error error,
|
||||||
void* errorData)
|
net_error_data* errorData)
|
||||||
{
|
{
|
||||||
flowf("\n");
|
flowf("\n");
|
||||||
|
|
||||||
@@ -308,9 +311,8 @@ l2cap_error_reply(net_protocol* protocol, net_buffer* causedError, uint32 code,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
// #pragma mark -
|
||||||
#pragma mark -
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
l2cap_std_ops(int32 op, ...)
|
l2cap_std_ops(int32 op, ...)
|
||||||
@@ -329,14 +331,15 @@ l2cap_std_ops(int32 op, ...)
|
|||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
error = gStackModule->register_domain_receiving_protocol(AF_BLUETOOTH,
|
error = gStackModule->register_domain_receiving_protocol(
|
||||||
|
AF_BLUETOOTH,
|
||||||
BLUETOOTH_PROTO_L2CAP,
|
BLUETOOTH_PROTO_L2CAP,
|
||||||
"network/protocols/l2cap/v1");
|
"network/protocols/l2cap/v1");
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
error = gStackModule->register_domain(AF_BLUETOOTH, "l2cap", &gL2CAPModule,
|
error = gStackModule->register_domain(AF_BLUETOOTH, "l2cap",
|
||||||
&gL2cap4AddressModule, &sDomain);
|
&gL2CAPModule, &gL2cap4AddressModule, &sDomain);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
@@ -391,7 +394,7 @@ net_protocol_module_info gL2CAPModule = {
|
|||||||
l2cap_get_mtu,
|
l2cap_get_mtu,
|
||||||
l2cap_receive_data,
|
l2cap_receive_data,
|
||||||
NULL, // deliver_data()
|
NULL, // deliver_data()
|
||||||
l2cap_error,
|
l2cap_error_received,
|
||||||
l2cap_error_reply,
|
l2cap_error_reply,
|
||||||
NULL, // add_ancillary_data()
|
NULL, // add_ancillary_data()
|
||||||
NULL, // process_ancillary_data()
|
NULL, // process_ancillary_data()
|
||||||
|
|||||||
@@ -728,15 +728,15 @@ tcp_receive_data(net_buffer* buffer)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
tcp_error(uint32 code, net_buffer* data)
|
tcp_error_received(net_error error, net_buffer* data)
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
tcp_error_reply(net_protocol* protocol, net_buffer* causedError, uint32 code,
|
tcp_error_reply(net_protocol* protocol, net_buffer* cause, net_error error,
|
||||||
void* errorData)
|
net_error_data* errorData)
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -861,7 +861,7 @@ net_protocol_module_info sTCPModule = {
|
|||||||
tcp_get_mtu,
|
tcp_get_mtu,
|
||||||
tcp_receive_data,
|
tcp_receive_data,
|
||||||
NULL, // deliver_data()
|
NULL, // deliver_data()
|
||||||
tcp_error,
|
tcp_error_received,
|
||||||
tcp_error_reply,
|
tcp_error_reply,
|
||||||
NULL, // add_ancillary_data()
|
NULL, // add_ancillary_data()
|
||||||
NULL, // process_ancillary_data()
|
NULL, // process_ancillary_data()
|
||||||
|
|||||||
@@ -13,8 +13,6 @@
|
|||||||
#include <net_protocol.h>
|
#include <net_protocol.h>
|
||||||
#include <net_stack.h>
|
#include <net_stack.h>
|
||||||
|
|
||||||
#include <icmp.h>
|
|
||||||
|
|
||||||
#include <lock.h>
|
#include <lock.h>
|
||||||
#include <util/AutoLock.h>
|
#include <util/AutoLock.h>
|
||||||
#include <util/DoublyLinkedList.h>
|
#include <util/DoublyLinkedList.h>
|
||||||
@@ -698,7 +696,7 @@ UdpEndpointManager::ReceiveData(net_buffer *buffer)
|
|||||||
TRACE_EPM(" ReceiveData(): no endpoint.");
|
TRACE_EPM(" ReceiveData(): no endpoint.");
|
||||||
// Send port unreachable error
|
// Send port unreachable error
|
||||||
domainSupport->Domain()->module->error_reply(NULL, buffer,
|
domainSupport->Domain()->module->error_reply(NULL, buffer,
|
||||||
icmp_encode(ICMP_TYPE_UNREACH, ICMP_CODE_PORT_UNREACH), NULL);
|
B_NET_ERROR_UNREACH_PORT, NULL);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1235,43 +1233,37 @@ udp_deliver_data(net_protocol *protocol, net_buffer *buffer)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
udp_error_received(uint32 code, net_buffer* buffer)
|
udp_error_received(net_error error, net_buffer* buffer)
|
||||||
{
|
{
|
||||||
uint8 icmpType, icmpCode;
|
status_t notifyError = B_OK;
|
||||||
icmp_decode(code, icmpType, icmpCode);
|
|
||||||
|
|
||||||
status_t error = B_OK;
|
switch (error) {
|
||||||
switch (icmpType) {
|
case B_NET_ERROR_UNREACH_NET:
|
||||||
case ICMP_TYPE_UNREACH:
|
notifyError = ENETUNREACH;
|
||||||
if (icmpCode == ICMP_CODE_NET_UNREACH)
|
|
||||||
error = ENETUNREACH;
|
|
||||||
else if (icmpCode == ICMP_CODE_HOST_UNREACH)
|
|
||||||
error = EHOSTUNREACH;
|
|
||||||
else if (icmpCode == ICMP_CODE_SOURCE_ROUTE_FAIL)
|
|
||||||
error = B_NOT_SUPPORTED;
|
|
||||||
else if (icmpCode == ICMP_CODE_PROTO_UNREACH)
|
|
||||||
error = ENOPROTOOPT;
|
|
||||||
else if (icmpCode == ICMP_CODE_PORT_UNREACH)
|
|
||||||
error = ECONNREFUSED;
|
|
||||||
else if (icmpCode == ICMP_CODE_FRAG_NEEDED)
|
|
||||||
error = EMSGSIZE;
|
|
||||||
else
|
|
||||||
error = B_NOT_SUPPORTED;
|
|
||||||
break;
|
break;
|
||||||
case ICMP_TYPE_TIME_EXCEEDED:
|
case B_NET_ERROR_UNREACH_HOST:
|
||||||
error = EHOSTUNREACH;
|
case B_NET_ERROR_TRANSIT_TIME_EXCEEDED:
|
||||||
|
notifyError = EHOSTUNREACH;
|
||||||
break;
|
break;
|
||||||
case ICMP_TYPE_PARAM_PROBLEM:
|
case B_NET_ERROR_UNREACH_PROTOCOL:
|
||||||
error = EPROTO;
|
case B_NET_ERROR_UNREACH_PORT:
|
||||||
|
notifyError = ECONNREFUSED;
|
||||||
break;
|
break;
|
||||||
case ICMP_TYPE_SOURCE_QUENCH:
|
case B_NET_ERROR_MESSAGE_SIZE:
|
||||||
|
notifyError = EMSGSIZE;
|
||||||
|
break;
|
||||||
|
case B_NET_ERROR_PARAMETER_PROBLEM:
|
||||||
|
notifyError = ENOPROTOOPT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_NET_ERROR_QUENCH:
|
||||||
default:
|
default:
|
||||||
// ignore them
|
// ignore them
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error != B_OK)
|
if (notifyError != B_OK)
|
||||||
sUdpEndpointManager->ReceiveError(error, buffer);
|
sUdpEndpointManager->ReceiveError(notifyError, buffer);
|
||||||
|
|
||||||
gBufferModule->free(buffer);
|
gBufferModule->free(buffer);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -1279,8 +1271,8 @@ udp_error_received(uint32 code, net_buffer* buffer)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
udp_error_reply(net_protocol *protocol, net_buffer *causedError, uint32 code,
|
udp_error_reply(net_protocol *protocol, net_buffer *cause, net_error error,
|
||||||
void *errorData)
|
net_error_data *errorData)
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
|
|
||||||
@@ -268,15 +269,15 @@ unix_deliver_data(net_protocol *_protocol, net_buffer *buffer)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
unix_error(uint32 code, net_buffer *data)
|
unix_error_received(net_error error, net_buffer *data)
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
unix_error_reply(net_protocol *protocol, net_buffer *causedError, uint32 code,
|
unix_error_reply(net_protocol *protocol, net_buffer *cause, net_error error,
|
||||||
void *errorData)
|
net_error_data *errorData)
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -504,7 +505,7 @@ net_protocol_module_info gUnixModule = {
|
|||||||
unix_get_mtu,
|
unix_get_mtu,
|
||||||
unix_receive_data,
|
unix_receive_data,
|
||||||
unix_deliver_data,
|
unix_deliver_data,
|
||||||
unix_error,
|
unix_error_received,
|
||||||
unix_error_reply,
|
unix_error_reply,
|
||||||
unix_add_ancillary_data,
|
unix_add_ancillary_data,
|
||||||
unix_process_ancillary_data,
|
unix_process_ancillary_data,
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ link_receive_data(net_buffer* buffer)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
link_error_received(uint32 code, net_buffer* data)
|
link_error_received(net_error error, net_buffer* data)
|
||||||
{
|
{
|
||||||
// We don't do any error processing
|
// We don't do any error processing
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -611,8 +611,8 @@ link_error_received(uint32 code, net_buffer* data)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
link_error_reply(net_protocol* protocol, net_buffer* causedError, uint32 code,
|
link_error_reply(net_protocol* protocol, net_buffer* cause, net_error error,
|
||||||
void* errorData)
|
net_error_data* errorData)
|
||||||
{
|
{
|
||||||
// We don't do any error processing
|
// We don't do any error processing
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|||||||
Reference in New Issue
Block a user