use PCB_IS_IPV6(pcb) instead of pcb->isipv6 everywhere

This commit is contained in:
goldsimon 2011-05-28 09:28:18 +00:00
parent ccd7dbe0e4
commit 2aec3a9789
6 changed files with 50 additions and 50 deletions

View File

@ -540,7 +540,7 @@ err_t
netconn_sendto(struct netconn *conn, struct netbuf *buf, ip_addr_t *addr, u16_t port)
{
if (buf != NULL) {
ipX_addr_set_ipaddr(conn->pcb.ip->isipv6, &buf->addr, addr);
ipX_addr_set_ipaddr(PCB_ISIPV6(conn->pcb.ip), &buf->addr, addr);
buf->port = port;
return netconn_send(conn, buf);
}

View File

@ -113,7 +113,7 @@ recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p,
buf->p = q;
buf->ptr = q;
ipX_addr_copy(pcb->isipv6, buf->addr, *ipX_current_src_addr());
ipX_addr_copy(PCB_ISIPV6(pcb), buf->addr, *ipX_current_src_addr());
buf->port = pcb->protocol;
len = q->tot_len;
@ -1118,7 +1118,7 @@ do_send(struct api_msg_msg *msg)
switch (NETCONNTYPE_GROUP(msg->conn->type)) {
#if LWIP_RAW
case NETCONN_RAW:
if (ipX_addr_isany(msg->conn->pcb.ip->isipv6, &msg->msg.b->addr)) {
if (ipX_addr_isany(PCB_ISIPV6(msg->conn->pcb.ip), &msg->msg.b->addr)) {
msg->err = raw_send(msg->conn->pcb.raw, msg->msg.b->p);
} else {
msg->err = raw_sendto(msg->conn->pcb.raw, msg->msg.b->p, ipX_2_ip(&msg->msg.b->addr));
@ -1128,7 +1128,7 @@ do_send(struct api_msg_msg *msg)
#if LWIP_UDP
case NETCONN_UDP:
#if LWIP_CHECKSUM_ON_COPY
if (ipX_addr_isany(msg->conn->pcb.ip->isipv6, &msg->msg.b->addr)) {
if (ipX_addr_isany(PCB_ISIPV6(msg->conn->pcb.ip), &msg->msg.b->addr)) {
msg->err = udp_send_chksum(msg->conn->pcb.udp, msg->msg.b->p,
msg->msg.b->flags & NETBUF_FLAG_CHKSUM, msg->msg.b->toport_chksum);
} else {
@ -1137,7 +1137,7 @@ do_send(struct api_msg_msg *msg)
msg->msg.b->flags & NETBUF_FLAG_CHKSUM, msg->msg.b->toport_chksum);
}
#else /* LWIP_CHECKSUM_ON_COPY */
if (ipX_addr_isany(msg->conn->pcb.ip->isipv6, &msg->msg.b->addr)) {
if (ipX_addr_isany(PCB_ISIPV6(msg->conn->pcb.ip), &msg->msg.b->addr)) {
msg->err = udp_send(msg->conn->pcb.udp, msg->msg.b->p);
} else {
msg->err = udp_sendto(msg->conn->pcb.udp, msg->msg.b->p, ipX_2_ip(&msg->msg.b->addr), msg->msg.b->port);
@ -1374,10 +1374,10 @@ do_getaddr(struct api_msg_msg *msg)
{
if (msg->conn->pcb.ip != NULL) {
if (msg->msg.ad.local) {
ipX_addr_copy(msg->conn->pcb.ip->isipv6, *(msg->msg.ad.ipaddr),
ipX_addr_copy(PCB_ISIPV6(msg->conn->pcb.ip), *(msg->msg.ad.ipaddr),
msg->conn->pcb.ip->local_ip);
} else {
ipX_addr_copy(msg->conn->pcb.ip->isipv6, *(msg->msg.ad.ipaddr),
ipX_addr_copy(PCB_ISIPV6(msg->conn->pcb.ip), *(msg->msg.ad.ipaddr),
msg->conn->pcb.ip->remote_ip);
}
msg->err = ERR_OK;
@ -1478,7 +1478,7 @@ do_join_leave_group(struct api_msg_msg *msg)
if (NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_UDP) {
#if LWIP_UDP
#if LWIP_IPV6 && LWIP_IPV6_MLD
if (msg->conn->pcb.udp->isipv6) {
if (PCB_ISIPV6(msg->conn->pcb.udp)) {
if (msg->msg.jl.join_or_leave == NETCONN_JOIN) {
msg->err = mld6_joingroup(ipX_2_ip6(msg->msg.jl.netif_addr),
ipX_2_ip6(msg->msg.jl.multiaddr));

View File

@ -106,13 +106,13 @@ raw_input(struct pbuf *p, struct netif *inp)
/* this allows multiple pcbs to match against the packet by design */
while ((eaten == 0) && (pcb != NULL)) {
if ((pcb->protocol == proto) && IP_PCB_IPVER_INPUT_MATCH(pcb) &&
(ipX_addr_isany(pcb->isipv6, &pcb->local_ip) ||
ipX_addr_cmp(pcb->isipv6, &(pcb->local_ip), ipX_current_dest_addr()))) {
(ipX_addr_isany(PCB_ISIPV6(pcb), &pcb->local_ip) ||
ipX_addr_cmp(PCB_ISIPV6(pcb), &(pcb->local_ip), ipX_current_dest_addr()))) {
#if IP_SOF_BROADCAST_RECV
/* broadcast filter? */
if (((pcb->so_options & SOF_BROADCAST) || !ip_addr_isbroadcast(ip_current_dest_addr(), inp))
#if LWIP_IPV6
&& !pcb->isipv6
&& !PCB_ISIPV6(pcb)
#endif /* LWIP_IPV6 */
)
#endif /* IP_SOF_BROADCAST_RECV */
@ -161,7 +161,7 @@ raw_input(struct pbuf *p, struct netif *inp)
err_t
raw_bind(struct raw_pcb *pcb, ip_addr_t *ipaddr)
{
ipX_addr_set_ipaddr(pcb->isipv6, &pcb->local_ip, ipaddr);
ipX_addr_set_ipaddr(PCB_ISIPV6(pcb), &pcb->local_ip, ipaddr);
return ERR_OK;
}
@ -181,7 +181,7 @@ raw_bind(struct raw_pcb *pcb, ip_addr_t *ipaddr)
err_t
raw_connect(struct raw_pcb *pcb, ip_addr_t *ipaddr)
{
ipX_addr_set_ipaddr(pcb->isipv6, &pcb->remote_ip, ipaddr);
ipX_addr_set_ipaddr(PCB_ISIPV6(pcb), &pcb->remote_ip, ipaddr);
return ERR_OK;
}
@ -233,7 +233,7 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr)
header_size = (
#if LWIP_IPV6
pcb->isipv6 ? IP6_HLEN :
PCB_ISIPV6(pcb) ? IP6_HLEN :
#endif /* LWIP_IPV6 */
IP_HLEN);
@ -261,10 +261,10 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr)
}
}
netif = ipX_route(pcb->isipv6, &pcb->local_ip, dst_ip);
netif = ipX_route(PCB_ISIPV6(pcb), &pcb->local_ip, dst_ip);
if (netif == NULL) {
LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_LEVEL_WARNING, ("raw_sendto: No route to "));
ipX_addr_debug_print(pcb->isipv6, RAW_DEBUG | LWIP_DBG_LEVEL_WARNING, dst_ip);
ipX_addr_debug_print(PCB_ISIPV6(pcb), RAW_DEBUG | LWIP_DBG_LEVEL_WARNING, dst_ip);
/* free any temporary header pbuf allocated by pbuf_header() */
if (q != p) {
pbuf_free(q);
@ -275,7 +275,7 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr)
#if IP_SOF_BROADCAST
#if LWIP_IPV6
/* @todo: why does IPv6 not filter broadcast with SOF_BROADCAST enabled? */
if (!netif->isipv6)
if (!PCB_ISIPV6(pcb))
#endif /* LWIP_IPV6 */
{
/* broadcast filter? */
@ -290,9 +290,9 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr)
}
#endif /* IP_SOF_BROADCAST */
if (ipX_addr_isany(pcb->isipv6, &pcb->local_ip)) {
if (ipX_addr_isany(PCB_ISIPV6(pcb), &pcb->local_ip)) {
/* use outgoing network interface IP address as source address */
src_ip = ipX_netif_get_local_ipX(pcb->isipv6, netif, dst_ip);
src_ip = ipX_netif_get_local_ipX(PCB_ISIPV6(pcb), netif, dst_ip);
#if LWIP_IPV6
if (src_ip == NULL) {
if (q != p) {
@ -307,7 +307,7 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr)
}
NETIF_SET_HWADDRHINT(netif, &pcb->addr_hint);
err = ipX_output_if(pcb->isipv6, q, ipX_2_ip(src_ip), ipX_2_ip(dst_ip), pcb->ttl, pcb->tos, pcb->protocol, netif);
err = ipX_output_if(PCB_ISIPV6(pcb), q, ipX_2_ip(src_ip), ipX_2_ip(dst_ip), pcb->ttl, pcb->tos, pcb->protocol, netif);
NETIF_SET_HWADDRHINT(netif, NULL);
/* did we chain a header earlier? */

View File

@ -151,7 +151,7 @@ tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data)
/* don't call tcp_abort here: we must not deallocate the pcb since
that might not be expected when calling tcp_close */
tcp_rst(pcb->snd_nxt, pcb->rcv_nxt, &pcb->local_ip, &pcb->remote_ip,
pcb->local_port, pcb->remote_port, pcb->isipv6);
pcb->local_port, pcb->remote_port, PCB_ISIPV6(pcb));
tcp_pcb_purge(pcb);
@ -356,7 +356,7 @@ tcp_abandon(struct tcp_pcb *pcb, int reset)
#endif /* TCP_QUEUE_OOSEQ */
if (reset) {
LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_abandon: sending RST\n"));
tcp_rst(seqno, ackno, &pcb->local_ip, &pcb->remote_ip, pcb->local_port, pcb->remote_port, pcb->isipv6);
tcp_rst(seqno, ackno, &pcb->local_ip, &pcb->remote_ip, pcb->local_port, pcb->remote_port, PCB_ISIPV6(pcb));
}
memp_free(MEMP_TCP_PCB, pcb);
TCP_EVENT_ERR(errf, errf_arg, ERR_ABRT);
@ -441,8 +441,8 @@ tcp_bind(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port)
}
}
if (!ipX_addr_isany(pcb->isipv6, ip_2_ipX(ipaddr))) {
ipX_addr_set(pcb->isipv6, &pcb->local_ip, ip_2_ipX(ipaddr));
if (!ipX_addr_isany(PCB_ISIPV6(pcb), ip_2_ipX(ipaddr))) {
ipX_addr_set(PCB_ISIPV6(pcb), &pcb->local_ip, ip_2_ipX(ipaddr));
}
pcb->local_port = port;
TCP_REG(&tcp_bound_pcbs, pcb);
@ -498,7 +498,7 @@ tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog)
for(lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
if ((lpcb->local_port == pcb->local_port) &&
IP_PCB_IPVER_EQ(pcb, lpcb)) {
if (ipX_addr_cmp(pcb->isipv6, &lpcb->local_ip, &pcb->local_ip)) {
if (ipX_addr_cmp(PCB_ISIPV6(pcb), &lpcb->local_ip, &pcb->local_ip)) {
/* this address/port is already used */
return NULL;
}
@ -519,10 +519,10 @@ tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog)
lpcb->ttl = pcb->ttl;
lpcb->tos = pcb->tos;
#if LWIP_IPV6
lpcb->isipv6 = pcb->isipv6;
PCB_ISIPV6(lpcb) = PCB_ISIPV6(pcb);
lpcb->accept_any_ip_version = 0;
#endif /* LWIP_IPV6 */
ipX_addr_copy(pcb->isipv6, lpcb->local_ip, pcb->local_ip);
ipX_addr_copy(PCB_ISIPV6(pcb), lpcb->local_ip, pcb->local_ip);
if (pcb->local_port != 0) {
TCP_RMV(&tcp_bound_pcbs, pcb);
}
@ -548,7 +548,7 @@ tcp_listen_dual_with_backlog(struct tcp_pcb *pcb, u8_t backlog)
{
struct tcp_pcb *lpcb;
if (!ipX_addr_isany(pcb->isipv6, &pcb->local_ip)) {
if (!ipX_addr_isany(PCB_ISIPV6(pcb), &pcb->local_ip)) {
return NULL;
}
lpcb = tcp_listen_with_backlog(pcb, backlog);
@ -689,18 +689,18 @@ tcp_connect(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port,
pcb->remote_port = port;
/* check if we have a route to the remote host */
if (ipX_addr_isany(pcb->isipv6, &pcb->local_ip)) {
if (ipX_addr_isany(PCB_ISIPV6(pcb), &pcb->local_ip)) {
/* no local IP address set, yet. */
struct netif *netif;
ipX_addr_t *local_ip;
ipX_route_get_local_ipX(pcb->isipv6, &pcb->remote_ip, &pcb->remote_ip, netif, local_ip);
ipX_route_get_local_ipX(PCB_ISIPV6(pcb), &pcb->local_ip, &pcb->remote_ip, netif, local_ip);
if ((netif == NULL) || (local_ip == NULL)) {
/* Don't even try to send a SYN packet if we have no route
since that will fail. */
return ERR_RTE;
}
/* Use the netif's IP address as local address. */
ipX_addr_copy(pcb->isipv6, pcb->local_ip, *local_ip);
/* Use the address as local address of the pcb. */
ipX_addr_copy(PCB_ISIPV6(pcb), pcb->local_ip, *local_ip);
}
old_local_port = pcb->local_port;
@ -741,7 +741,7 @@ tcp_connect(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port,
The send MSS is updated when an MSS option is received. */
pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS;
#if TCP_CALCULATE_EFF_SEND_MSS
pcb->mss = tcp_eff_send_mss(pcb->mss, &pcb->local_ip, &pcb->remote_ip, pcb->isipv6);
pcb->mss = tcp_eff_send_mss(pcb->mss, &pcb->local_ip, &pcb->remote_ip, PCB_ISIPV6(pcb));
#endif /* TCP_CALCULATE_EFF_SEND_MSS */
pcb->cwnd = 1;
pcb->ssthresh = pcb->mss * 10;
@ -881,7 +881,7 @@ tcp_slowtmr(void)
#endif /* LWIP_TCP_KEEPALIVE */
{
LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: KEEPALIVE timeout. Aborting connection to "));
ipX_addr_debug_print(pcb->isipv6, TCP_DEBUG, &pcb->remote_ip);
ipX_addr_debug_print(PCB_ISIPV6(pcb), TCP_DEBUG, &pcb->remote_ip);
LWIP_DEBUGF(TCP_DEBUG, ("\n"));
++pcb_remove;
@ -948,7 +948,7 @@ tcp_slowtmr(void)
TCP_EVENT_ERR(pcb->errf, pcb->callback_arg, ERR_ABRT);
if (pcb_reset) {
tcp_rst(pcb->snd_nxt, pcb->rcv_nxt, &pcb->local_ip, &pcb->remote_ip,
pcb->local_port, pcb->remote_port, pcb->isipv6);
pcb->local_port, pcb->remote_port, PCB_ISIPV6(pcb));
}
pcb2 = pcb;
@ -1423,8 +1423,8 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
if ((lpcb->local_port == pcb->local_port) &&
IP_PCB_IPVER_EQ(pcb, lpcb) &&
(ipX_addr_isany(lpcb->isipv6, &lpcb->local_ip) ||
ipX_addr_cmp(lpcb->isipv6, &pcb->local_ip, &lpcb->local_ip))) {
(ipX_addr_isany(PCB_ISIPV6(lpcb), &lpcb->local_ip) ||
ipX_addr_cmp(PCB_ISIPV6(lpcb), &pcb->local_ip, &lpcb->local_ip))) {
/* port and address of the listen pcb match the timed-out pcb */
LWIP_ASSERT("tcp_pcb_purge: listen pcb does not have accepts pending",
lpcb->accepts_pending > 0);

View File

@ -476,7 +476,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
#endif /* TCP_LISTEN_BACKLOG */
/* Set up the new PCB. */
#if LWIP_IPV6
npcb->isipv6 = ip_current_is_v6();
PCB_ISIPV6(npcb) = ip_current_is_v6();
#endif /* LWIP_IPV6 */
ipX_addr_copy(ip_current_is_v6(), npcb->local_ip, *ipX_current_dest_addr());
ipX_addr_copy(ip_current_is_v6(), npcb->remote_ip, *ipX_current_src_addr());
@ -502,7 +502,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
tcp_parseopt(npcb);
#if TCP_CALCULATE_EFF_SEND_MSS
npcb->mss = tcp_eff_send_mss(npcb->mss, &npcb->local_ip,
&npcb->remote_ip, npcb->isipv6);
&npcb->remote_ip, PCB_ISIPV6(npcb));
#endif /* TCP_CALCULATE_EFF_SEND_MSS */
snmp_inc_tcppassiveopens();
@ -643,7 +643,7 @@ tcp_process(struct tcp_pcb *pcb)
#if TCP_CALCULATE_EFF_SEND_MSS
pcb->mss = tcp_eff_send_mss(pcb->mss, &pcb->local_ip, &pcb->remote_ip,
pcb->isipv6);
PCB_ISIPV6(pcb));
#endif /* TCP_CALCULATE_EFF_SEND_MSS */
/* Set ssthresh again after changing pcb->mss (already set in tcp_connect
@ -1027,7 +1027,7 @@ tcp_receive(struct tcp_pcb *pcb)
pcb->polltmr = 0;
#if LWIP_IPV6 && LWIP_ND6_TCP_REACHABILITY_HINTS
if (pcb->isipv6) {
if (PCB_ISIPV6(pcb)) {
/* Inform neighbor reachability of forward progress. */
nd6_reachability_hint(ip6_current_src_addr());
}
@ -1350,7 +1350,7 @@ tcp_receive(struct tcp_pcb *pcb)
tcp_ack(pcb);
#if LWIP_IPV6 && LWIP_ND6_TCP_REACHABILITY_HINTS
if (pcb->isipv6) {
if (PCB_ISIPV6(pcb)) {
/* Inform neighbor reachability of forward progress. */
nd6_reachability_hint(ip6_current_src_addr());
}

View File

@ -869,14 +869,14 @@ tcp_send_empty_ack(struct tcp_pcb *pcb)
#endif
#if CHECKSUM_GEN_TCP
tcphdr->chksum = ipX_chksum_pseudo(pcb->isipv6, p, IP_PROTO_TCP, p->tot_len,
tcphdr->chksum = ipX_chksum_pseudo(PCB_ISIPV6(pcb), p, IP_PROTO_TCP, p->tot_len,
&pcb->local_ip, &pcb->remote_ip);
#endif
#if LWIP_NETIF_HWADDRHINT
ipX_output_hinted(pcb->isipv6, p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, pcb->tos,
ipX_output_hinted(PCB_ISIPV6(pcb), p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, pcb->tos,
IP_PROTO_TCP, &pcb->addr_hint);
#else /* LWIP_NETIF_HWADDRHINT*/
ipX_output(pcb->isipv6, p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, pcb->tos,
ipX_output(PCB_ISIPV6(pcb), p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, pcb->tos,
IP_PROTO_TCP);
#endif /* LWIP_NETIF_HWADDRHINT*/
pbuf_free(p);
@ -1088,14 +1088,14 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
/* If we don't have a local IP address, we get one by
calling ip_route(). */
if (ipX_addr_isany(pcb->isipv6, &pcb->local_ip)) {
if (ipX_addr_isany(PCB_ISIPV6(pcb), &pcb->local_ip)) {
struct netif *netif;
ipX_addr_t *local_ip;
ipX_route_get_local_ipX(pcb->isipv6, &pcb->local_ip, &pcb->remote_ip, netif, local_ip);
ipX_route_get_local_ipX(PCB_ISIPV6(pcb), &pcb->local_ip, &pcb->remote_ip, netif, local_ip);
if ((netif == NULL) || (local_ip == NULL)) {
return;
}
ipX_addr_copy(pcb->isipv6, pcb->local_ip, *local_ip);
ipX_addr_copy(PCB_ISIPV6(pcb), pcb->local_ip, *local_ip);
}
if (pcb->rttest == 0) {
@ -1358,7 +1358,7 @@ tcp_keepalive(struct tcp_pcb *pcb)
struct tcp_hdr *tcphdr;
LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: sending KEEPALIVE probe to "));
ipX_addr_debug_print(pcb->isipv6, TCP_DEBUG, &pcb->remote_ip);
ipX_addr_debug_print(PCB_ISIPV6(pcb), TCP_DEBUG, &pcb->remote_ip);
LWIP_DEBUGF(TCP_DEBUG, ("\n"));
LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: tcp_ticks %"U32_F" pcb->tmr %"U32_F" pcb->keep_cnt_sent %"U16_F"\n",
@ -1410,7 +1410,7 @@ tcp_zero_window_probe(struct tcp_pcb *pcb)
u8_t is_fin;
LWIP_DEBUGF(TCP_DEBUG, ("tcp_zero_window_probe: sending ZERO WINDOW probe to "));
ipX_addr_debug_print(pcb->isipv6, TCP_DEBUG, &pcb->remote_ip);
ipX_addr_debug_print(PCB_ISIPV6(pcb), TCP_DEBUG, &pcb->remote_ip);
LWIP_DEBUGF(TCP_DEBUG, ("\n"));
LWIP_DEBUGF(TCP_DEBUG,