mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-09-26 02:33:38 +08:00
Compiler warning fixes (mostly constness in dual-stack configurations)
This commit is contained in:
committed by
goldsimon
parent
726af89168
commit
f62022cdf3
@@ -1597,7 +1597,7 @@ dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr,
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_recv(pbuf = %p) from DHCP server %"U16_F".%"U16_F".%"U16_F".%"U16_F" port %"U16_F"\n", (void*)p,
|
||||
ip4_addr1_16(ip_2_ip4(addr)), ip4_addr2_16(ip_2_ip4(addr)), ip4_addr3_16(ip_2_ip4(addr)), ip4_addr4_16(ip_2_ip4(addr)), port));
|
||||
ip4_addr1_16(ip_2_ip4_c(addr)), ip4_addr2_16(ip_2_ip4_c(addr)), ip4_addr3_16(ip_2_ip4_c(addr)), ip4_addr4_16(ip_2_ip4_c(addr)), port));
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("pbuf->len = %"U16_F"\n", p->len));
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("pbuf->tot_len = %"U16_F"\n", p->tot_len));
|
||||
/* prevent warnings about unused arguments */
|
||||
|
||||
@@ -431,7 +431,7 @@ dns_init(void)
|
||||
* @param dnsserver IP address of the DNS server to set
|
||||
*/
|
||||
void
|
||||
dns_setserver(u8_t numdns, ip_addr_t *dnsserver)
|
||||
dns_setserver(u8_t numdns, const ip_addr_t *dnsserver)
|
||||
{
|
||||
if (numdns < DNS_MAX_SERVERS) {
|
||||
if (dnsserver != NULL) {
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include "lwip/inet_chksum.h"
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
@@ -385,7 +386,7 @@ ip_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||
{
|
||||
#if LWIP_IPV6
|
||||
if (IP_IS_V6(dest)) {
|
||||
return ip6_chksum_pseudo(p, proto, proto_len, ip_2_ip6(src), ip_2_ip6(dest));
|
||||
return ip6_chksum_pseudo(p, proto, proto_len, ip_2_ip6_c(src), ip_2_ip6_c(dest));
|
||||
}
|
||||
#endif /* LWIP_IPV6 */
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
@@ -393,7 +394,7 @@ ip_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
#if LWIP_IPV4
|
||||
{
|
||||
return inet_chksum_pseudo(p, proto, proto_len, ip_2_ip4(src), ip_2_ip4(dest));
|
||||
return inet_chksum_pseudo(p, proto, proto_len, ip_2_ip4_c(src), ip_2_ip4_c(dest));
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
}
|
||||
@@ -532,7 +533,7 @@ ip_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||
{
|
||||
#if LWIP_IPV6
|
||||
if (IP_IS_V6(dest)) {
|
||||
return ip6_chksum_pseudo_partial(p, proto, proto_len, chksum_len, ip_2_ip6(src), ip_2_ip6(dest));
|
||||
return ip6_chksum_pseudo_partial(p, proto, proto_len, chksum_len, ip_2_ip6_c(src), ip_2_ip6_c(dest));
|
||||
}
|
||||
#endif /* LWIP_IPV6 */
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
@@ -540,7 +541,7 @@ ip_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
#if LWIP_IPV4
|
||||
{
|
||||
return inet_chksum_pseudo_partial(p, proto, proto_len, chksum_len, ip_2_ip4(src), ip_2_ip4(dest));
|
||||
return inet_chksum_pseudo_partial(p, proto, proto_len, chksum_len, ip_2_ip4_c(src), ip_2_ip4_c(dest));
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ igmp_start(struct netif *netif)
|
||||
{
|
||||
struct igmp_group* group;
|
||||
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_start: starting IGMP processing on if %p\n", netif));
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_start: starting IGMP processing on if %p\n", (void*)netif));
|
||||
|
||||
group = igmp_lookup_group(netif, &allsystems);
|
||||
|
||||
@@ -183,7 +183,7 @@ igmp_start(struct netif *netif)
|
||||
if (netif->igmp_mac_filter != NULL) {
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_start: igmp_mac_filter(ADD "));
|
||||
ip4_addr_debug_print_val(IGMP_DEBUG, allsystems);
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", netif));
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", (void*)netif));
|
||||
netif->igmp_mac_filter(netif, &allsystems, IGMP_ADD_MAC_FILTER);
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ igmp_stop(struct netif *netif)
|
||||
if (netif->igmp_mac_filter != NULL) {
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_stop: igmp_mac_filter(DEL "));
|
||||
ip4_addr_debug_print(IGMP_DEBUG, &group->group_address);
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", netif));
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", (void*)netif));
|
||||
netif->igmp_mac_filter(netif, &(group->group_address), IGMP_DEL_MAC_FILTER);
|
||||
}
|
||||
/* free group */
|
||||
@@ -247,7 +247,7 @@ igmp_report_groups(struct netif *netif)
|
||||
{
|
||||
struct igmp_group *group = igmp_group_list;
|
||||
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_report_groups: sending IGMP reports on if %p\n", netif));
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_report_groups: sending IGMP reports on if %p\n", (void*)netif));
|
||||
|
||||
while (group != NULL) {
|
||||
if ((group->netif == netif) && (!(ip4_addr_cmp(&(group->group_address), &allsystems)))) {
|
||||
@@ -319,7 +319,7 @@ igmp_lookup_group(struct netif *ifp, const ip4_addr_t *addr)
|
||||
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_lookup_group: %sallocated a new group with address ", (group?"":"impossible to ")));
|
||||
ip4_addr_debug_print(IGMP_DEBUG, addr);
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", ifp));
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", (void*)ifp));
|
||||
|
||||
return group;
|
||||
}
|
||||
@@ -385,7 +385,7 @@ igmp_input(struct pbuf *p, struct netif *inp, const ip4_addr_t *dest)
|
||||
ip4_addr_debug_print(IGMP_DEBUG, &(ip4_current_header()->src));
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (" to address "));
|
||||
ip4_addr_debug_print(IGMP_DEBUG, &(ip4_current_header()->dest));
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", inp));
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", (void*)inp));
|
||||
|
||||
/* Now calculate and check the checksum */
|
||||
igmp = (struct igmp_msg *)p->payload;
|
||||
@@ -471,7 +471,7 @@ igmp_input(struct pbuf *p, struct netif *inp, const ip4_addr_t *dest)
|
||||
}
|
||||
default: {
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: unexpected msg %d in state %d on group %p on if %p\n",
|
||||
igmp->igmp_msgtype, group->group_state, &group, group->netif));
|
||||
igmp->igmp_msgtype, group->group_state, (void*)&group, (void*)group->netif));
|
||||
IGMP_STATS_INC(igmp.proterr);
|
||||
break;
|
||||
}
|
||||
@@ -521,7 +521,7 @@ igmp_joingroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr)
|
||||
if ((group->use==0) && (netif->igmp_mac_filter != NULL)) {
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_joingroup: igmp_mac_filter(ADD "));
|
||||
ip4_addr_debug_print(IGMP_DEBUG, groupaddr);
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", netif));
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", (void*)netif));
|
||||
netif->igmp_mac_filter(netif, groupaddr, IGMP_ADD_MAC_FILTER);
|
||||
}
|
||||
|
||||
@@ -596,7 +596,7 @@ igmp_leavegroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr)
|
||||
if (netif->igmp_mac_filter != NULL) {
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup: igmp_mac_filter(DEL "));
|
||||
ip4_addr_debug_print(IGMP_DEBUG, groupaddr);
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", netif));
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", (void*)netif));
|
||||
netif->igmp_mac_filter(netif, groupaddr, IGMP_DEL_MAC_FILTER);
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ igmp_timeout(struct igmp_group *group)
|
||||
(!(ip4_addr_cmp(&(group->group_address), &allsystems)))) {
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_timeout: report membership for group with address "));
|
||||
ip4_addr_debug_print(IGMP_DEBUG, &(group->group_address));
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", group->netif));
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", (void*)group->netif));
|
||||
|
||||
IGMP_STATS_INC(igmp.tx_report);
|
||||
igmp_send(group, IGMP_V2_MEMB_REPORT);
|
||||
|
||||
@@ -151,10 +151,10 @@ ethip6_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr)
|
||||
/* Hash IP multicast address to MAC address.*/
|
||||
dest.addr[0] = 0x33;
|
||||
dest.addr[1] = 0x33;
|
||||
dest.addr[2] = ((u8_t *)(&(ip6addr->addr[3])))[0];
|
||||
dest.addr[3] = ((u8_t *)(&(ip6addr->addr[3])))[1];
|
||||
dest.addr[4] = ((u8_t *)(&(ip6addr->addr[3])))[2];
|
||||
dest.addr[5] = ((u8_t *)(&(ip6addr->addr[3])))[3];
|
||||
dest.addr[2] = ((const u8_t *)(&(ip6addr->addr[3])))[0];
|
||||
dest.addr[3] = ((const u8_t *)(&(ip6addr->addr[3])))[1];
|
||||
dest.addr[4] = ((const u8_t *)(&(ip6addr->addr[3])))[2];
|
||||
dest.addr[5] = ((const u8_t *)(&(ip6addr->addr[3])))[3];
|
||||
|
||||
/* Send out. */
|
||||
return ethip6_send(netif, q, (struct eth_addr*)(netif->hwaddr), &dest);
|
||||
|
||||
@@ -269,7 +269,7 @@ ip6_reass(struct pbuf *p)
|
||||
IP6_FRAG_STATS_INC(ip6_frag.recv);
|
||||
|
||||
LWIP_ASSERT("ip6_frag_hdr must be in the first pbuf, not chained",
|
||||
(void*)ip6_current_header() == ((u8_t*)p->payload) - IP6_HLEN);
|
||||
(const void*)ip6_current_header() == ((u8_t*)p->payload) - IP6_HLEN);
|
||||
|
||||
frag_hdr = (struct ip6_frag_hdr *) p->payload;
|
||||
|
||||
@@ -281,7 +281,7 @@ ip6_reass(struct pbuf *p)
|
||||
* Adjust for headers before Fragment Header.
|
||||
* And finally adjust by Fragment Header length. */
|
||||
len = ntohs(ip6_current_header()->_plen);
|
||||
len -= (u16_t)(((u8_t*)p->payload - (u8_t*)ip6_current_header()) - IP6_HLEN);
|
||||
len -= (u16_t)(((u8_t*)p->payload - (const u8_t*)ip6_current_header()) - IP6_HLEN);
|
||||
len -= IP6_FRAG_HLEN;
|
||||
|
||||
/* Look for the datagram the fragment belongs to in the current datagram queue,
|
||||
|
||||
@@ -332,7 +332,7 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr)
|
||||
/* If requested, based on the IPV6_CHECKSUM socket option per RFC3542,
|
||||
compute the checksum and update the checksum in the payload. */
|
||||
if (PCB_ISIPV6(pcb) && pcb->chksum_reqd) {
|
||||
u16_t chksum = ip6_chksum_pseudo(p, pcb->protocol, p->tot_len, ip_2_ip6(src_ip), ip_2_ip6(dst_ip));
|
||||
u16_t chksum = ip6_chksum_pseudo(p, pcb->protocol, p->tot_len, ip_2_ip6_c(src_ip), ip_2_ip6_c(dst_ip));
|
||||
LWIP_ASSERT("Checksum must fit into first pbuf", p->len >= (pcb->chksum_offset + 2));
|
||||
SMEMCPY(((u8_t *)p->payload) + pcb->chksum_offset, &chksum, sizeof(u16_t));
|
||||
}
|
||||
|
||||
@@ -747,7 +747,7 @@ const struct mib_array_node mgmt = {
|
||||
/* When using a private MIB, you have to create a file 'private_mib.h' that contains
|
||||
* a 'struct mib_array_node mib_private' which contains your MIB. */
|
||||
s32_t internet_ids[2] = { 2, 4 };
|
||||
const struct mib_node* const internet_nodes[2] = { (struct mib_node*)&mgmt, (struct mib_node*)&mib_private };
|
||||
const struct mib_node* const internet_nodes[2] = { (const struct mib_node*)&mgmt, (const struct mib_node*)&mib_private };
|
||||
const struct mib_array_node internet = {
|
||||
&noleafs_get_object_def,
|
||||
&noleafs_get_value,
|
||||
|
||||
@@ -1806,7 +1806,7 @@ tcp_eff_send_mss_impl(u16_t sendmss, const ip_addr_t *dest
|
||||
#endif /* LWIP_IPV4 */
|
||||
{
|
||||
/* First look in destination cache, to see if there is a Path MTU. */
|
||||
mtu = nd6_get_destination_mtu(ip_2_ip6(dest), outif);
|
||||
mtu = nd6_get_destination_mtu(ip_2_ip6_c(dest), outif);
|
||||
}
|
||||
#if LWIP_IPV4
|
||||
else
|
||||
|
||||
@@ -158,7 +158,9 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
struct udp_pcb *uncon_pcb;
|
||||
u16_t src, dest;
|
||||
u8_t local_match;
|
||||
#if LWIP_IPV4
|
||||
u8_t broadcast;
|
||||
#endif /* LWIP_IPV4 */
|
||||
u8_t for_us;
|
||||
|
||||
LWIP_UNUSED_ARG(inp);
|
||||
@@ -181,8 +183,10 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
|
||||
udphdr = (struct udp_hdr *)p->payload;
|
||||
|
||||
#if LWIP_IPV4
|
||||
/* is broadcast packet ? */
|
||||
broadcast = ip_addr_isbroadcast(ip_current_dest_addr(), ip_current_netif());
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
LWIP_DEBUGF(UDP_DEBUG, ("udp_input: received datagram of length %"U16_F"\n", p->tot_len));
|
||||
|
||||
@@ -653,7 +657,7 @@ udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_i
|
||||
#if LWIP_IPV6
|
||||
if (PCB_ISIPV6(pcb)) {
|
||||
if (ip6_addr_isany(ip_2_ip6(&pcb->local_ip))) {
|
||||
src_ip = ip6_2_ip(ip6_select_source_address(netif, ip_2_ip6(dst_ip)), &src_ip_tmp);
|
||||
src_ip = ip6_2_ip(ip6_select_source_address(netif, ip_2_ip6_c(dst_ip)), &src_ip_tmp);
|
||||
if (src_ip == NULL) {
|
||||
/* No suitable source address was found. */
|
||||
return ERR_RTE;
|
||||
|
||||
Reference in New Issue
Block a user