added proper accessor functions for pcb->multicast_ip (previously used by get/setsockopt only)

This commit is contained in:
sg 2015-02-22 21:49:46 +01:00
parent ec5cf8593e
commit 03159254ce
3 changed files with 17 additions and 4 deletions

View File

@ -202,6 +202,10 @@ HISTORY
++ Bugfixes:
2015-02-22: Simon Goldschmidt
* udp.h, sockets.c: added proper accessor functions for pcb->multicast_ip
(previously used by get/setsockopt only)
2015-02-18: Simon Goldschmidt
* sockets.c: Fixed select not reporting received FIN as 'readable' in certain
rare cases (bug #43779: select(), close(), and TCP retransmission error)
@ -209,7 +213,7 @@ HISTORY
2015-02-17: Simon Goldschmidt
* err.h, sockets.c, api_msg.c: fixed bug #38853 "connect() use a wrong errno":
return ERR_ALREADY/EALRADY during connect, ERR_ISCONN/EISCONN when already
connected
connected
2015-02-17: Simon Goldschmidt
* tcp_impl.h, tcp_out.c, tcp.c, api_msg.c: fixed bug #37614 "Errors from

View File

@ -1784,7 +1784,7 @@ lwip_getsockopt_impl(int s, int level, int optname, void *optval, socklen_t *opt
if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) != NETCONN_UDP) {
return ENOPROTOOPT;
}
inet_addr_from_ipaddr((struct in_addr*)optval, &sock->conn->pcb.udp->multicast_ip);
inet_addr_from_ipaddr((struct in_addr*)optval, udp_get_multicast_netif_addr(sock->conn->pcb.udp));
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, IP_MULTICAST_IF) = 0x%"X32_F"\n",
s, *(u32_t *)optval));
break;
@ -2135,8 +2135,12 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_
sock->conn->pcb.udp->ttl = (u8_t)(*(u8_t*)optval);
break;
case IP_MULTICAST_IF:
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock, optlen, struct in_addr, NETCONN_UDP);
inet_addr_to_ipaddr(&sock->conn->pcb.udp->multicast_ip, (struct in_addr*)optval);
{
ip_addr_t if_addr;
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock, optlen, struct in_addr, NETCONN_UDP);
inet_addr_to_ipaddr(&if_addr, (struct in_addr*)optval);
udp_set_multicast_netif_addr(sock->conn->pcb.udp, &if_addr);
}
break;
case IP_MULTICAST_LOOP:
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock, optlen, u8_t, NETCONN_UDP);

View File

@ -206,6 +206,11 @@ struct udp_pcb * udp_new_ip6(void);
#endif /*LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */
#endif /* LWIP_IPV6 */
#if LWIP_IGMP
#define udp_set_multicast_netif_addr(pcb, ip4addr) ((pcb)->multicast_ip = *(ip4addr))
#define udp_get_multicast_netif_addr(pcb) (&(pcb)->multicast_ip)
#endif /* LWIP_IGMP */
#if UDP_DEBUG
void udp_debug_print(struct udp_hdr *udphdr);
#else