From 81ac03a28b4a96babcf3e38570384f4eb013933e Mon Sep 17 00:00:00 2001 From: goldsimon Date: Tue, 22 May 2007 07:31:06 +0000 Subject: [PATCH] Included patch #5938: changed raw_pcb.protocol from u16_t to u8_t since for IPv4 and IPv6, proto is only 8 bits wide. This affects the api, as there, the protocol was u16_t, too. --- CHANGELOG | 6 ++++++ src/api/api_lib.c | 6 +++--- src/api/api_msg.c | 4 ++-- src/core/raw.c | 2 +- src/include/lwip/api.h | 2 +- src/include/lwip/api_msg.h | 1 + src/include/lwip/raw.h | 8 ++++---- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3c5fef53..bd310580 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -166,6 +166,12 @@ HISTORY ++ Bug fixes: + 2007-05-22 Simon Goldschmidt + * api_lib.c, api_msg.c, raw.c, api.h, api_msg.h, raw.h: Included patch #5938: + changed raw_pcb.protocol from u16_t to u8_t since for IPv4 and IPv6, proto + is only 8 bits wide. This affects the api, as there, the protocol was + u16_t, too. + 2007-05-18 Simon Goldschmidt * memp.c: addition to patch #5913: smaller pointer was returned but memp_memory was the same size -> did not save memory. diff --git a/src/api/api_lib.c b/src/api/api_lib.c index d5dd85bc..2735b95f 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -182,7 +182,7 @@ netbuf_copy_partial(struct netbuf *buf, void *dataptr, u16_t len, u16_t offset) } struct -netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u16_t proto, +netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto, void (*callback)(struct netconn *, enum netconn_evt, u16_t len)) { struct netconn *conn; @@ -218,7 +218,7 @@ netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u16_t proto, #endif /* LWIP_SO_RCVTIMEO */ msg.function = do_newconn; - msg.msg.msg.bc.port = proto; /* misusing the port field */ + msg.msg.msg.raw_proto = proto; msg.msg.conn = conn; tcpip_apimsg(&msg); @@ -682,7 +682,7 @@ netconn_join_leave_group (struct netconn *conn, msg.function = do_join_leave_group; msg.msg.conn = conn; msg.msg.msg.bc.ipaddr = (struct ip_addr *)ipaddr; - msg.msg.msg.bc.port = join_or_leave; + msg.msg.msg.bc.port = join_or_leave; /* misusing the port field */ tcpip_apimsg(&msg); return conn->err; } diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 4915b1aa..5d250f4d 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -293,7 +293,7 @@ pcb_new(struct api_msg_msg *msg) switch(msg->conn->type) { #if LWIP_RAW case NETCONN_RAW: - msg->conn->pcb.raw = raw_new(msg->msg.bc.port); /* misusing the port field */ + msg->conn->pcb.raw = raw_new(msg->msg.raw_proto); if(msg->conn->pcb.raw == NULL) { msg->conn->err = ERR_MEM; break; @@ -667,7 +667,7 @@ do_join_leave_group(struct api_msg_msg *msg) case NETCONN_UDPLITE: case NETCONN_UDPNOCHKSUM: case NETCONN_UDP: - switch(msg->msg.bc.port){ + switch(msg->msg.bc.port){ /* misusing the port field */ case NETCONN_JOIN: msg->conn->err = igmp_joingroup (netif_default, ((struct ip_addr**)(msg->msg.bc.ipaddr))[0]); break; case NETCONN_LEAVE: msg->conn->err = igmp_leavegroup(netif_default, ((struct ip_addr**)(msg->msg.bc.ipaddr))[0]); break; } diff --git a/src/core/raw.c b/src/core/raw.c index a82315b0..9dedd50d 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -310,7 +310,7 @@ raw_remove(struct raw_pcb *pcb) * @see raw_remove() */ struct raw_pcb * -raw_new(u16_t proto) { +raw_new(u8_t proto) { struct raw_pcb *pcb; LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE | 3, ("raw_new\n")); diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h index 87c471a5..3722c451 100644 --- a/src/include/lwip/api.h +++ b/src/include/lwip/api.h @@ -143,7 +143,7 @@ struct netconn *netconn_new_with_callback(enum netconn_type t, void (*callback)(struct netconn *, enum netconn_evt, u16_t len)); struct -netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u16_t proto, +netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto, void (*callback)(struct netconn *, enum netconn_evt, u16_t len)); err_t netconn_delete (struct netconn *conn); enum netconn_type netconn_type (struct netconn *conn); diff --git a/src/include/lwip/api_msg.h b/src/include/lwip/api_msg.h index 268cc656..dc19dc69 100644 --- a/src/include/lwip/api_msg.h +++ b/src/include/lwip/api_msg.h @@ -67,6 +67,7 @@ struct api_msg_msg { } w; sys_mbox_t mbox; u16_t len; + u8_t raw_proto; } msg; }; diff --git a/src/include/lwip/raw.h b/src/include/lwip/raw.h index e4451650..62a545ba 100644 --- a/src/include/lwip/raw.h +++ b/src/include/lwip/raw.h @@ -48,7 +48,7 @@ struct raw_pcb { struct raw_pcb *next; - u16_t protocol; + u8_t protocol; u8_t (* recv)(void *arg, struct raw_pcb *pcb, struct pbuf *p, struct ip_addr *addr); @@ -57,7 +57,7 @@ struct raw_pcb { /* The following functions is the application layer interface to the RAW code. */ -struct raw_pcb * raw_new (u16_t proto); +struct raw_pcb * raw_new (u8_t proto); void raw_remove (struct raw_pcb *pcb); err_t raw_bind (struct raw_pcb *pcb, struct ip_addr *ipaddr); err_t raw_connect (struct raw_pcb *pcb, struct ip_addr *ipaddr); @@ -67,11 +67,11 @@ void raw_recv (struct raw_pcb *pcb, struct pbuf *p, struct ip_addr *addr), void *recv_arg); -err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, struct ip_addr *ipaddr); +err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, struct ip_addr *ipaddr); err_t raw_send (struct raw_pcb *pcb, struct pbuf *p); /* The following functions are the lower layer interface to RAW. */ -u8_t raw_input (struct pbuf *p, struct netif *inp); +u8_t raw_input (struct pbuf *p, struct netif *inp); void raw_init (void); #ifdef __cplusplus