Compiler warnings lwip / xemacpsif.c

Open
#283 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c
Domain
networking

Research direction

Start in embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif.c and compare xemacpsif_output and the MAC filter callbacks with the lwIP callback declarations shown in the warnings. Review the corresponding declarations in lwip/src/include/netif/etharp.h and the netif headers, then rebuild the affected lwIP target. Done means these incompatible-pointer-type warnings no longer occur.

Written by the indexing model from the issue text.

Description

There are a couple of warnings coming from xemacpsif.c

  1. Cast from ip_addr_t * to ip4/6_addr_t* missing
  2. Callback functions do not match the signatures defined by lwip
../../embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif.c: In function 'xemacpsif_output':
../../embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif.c:242:40: warning: passing argument 3 of 'etharp_output' from incompatible pointer type [-Wincompatible-pointer-types]
  242 |         return etharp_output(netif, p, ipaddr);
      |                                        ^~~~~~
      |                                        |
      |                                        const ip_addr_t * {aka const struct ip_addr *}
In file included from ../../lwip/src/include/netif/etharp.h:2,
                 from ../../embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif.c:45:
../../lwip/src/include/lwip/etharp.h:81:76: note: expected 'const ip4_addr_t *' {aka 'const struct ip4_addr *'} but argument is of type 'const ip_addr_t *' {aka 'const struct ip_addr *'}
   81 | err_t etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr);
      |                                                          ~~~~~~~~~~~~~~~~~~^~~~~~
../../embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif.c: In function 'low_level_init':
../../embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif.c:377:24: warning: assignment to 'netif_mld_mac_filter_fn' {aka 'signed char (*)(struct netif *, const struct ip6_addr *, enum netif_mac_filter_action)'} from incompatible pointer type 'err_t (*)(struct netif *, ip_addr_t *, u8_t)' {aka 'signed char (*)(struct netif *, struct ip_addr *, unsigned char)'} [-Wincompatible-pointer-types]
  377 |  netif->mld_mac_filter = xemacpsif_mld6_mac_filter_update;
      |                        ^
../../embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif.c: In function 'xemacpsif_init':
../../embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif.c:768:23: warning: assignment to 'netif_output_fn' {aka 'signed char (*)(struct netif *, struct pbuf *, const struct ip4_addr *)'} from incompatible pointer type 'err_t (*)(struct netif *, struct pbuf *, const ip_addr_t *)' {aka 'signed char (*)(struct netif *, struct pbuf *, const struct ip_addr *)'} [-Wincompatible-pointer-types]
  768 |         netif->output = xemacpsif_output;
      |                 

Should become something like:

static err_t xemacpsif_mac_filter_update (struct netif *netif,
							const ip4_addr_t *group,
							enum netif_mac_filter_action action);
static err_t xemacpsif_mld6_mac_filter_update (struct netif *netif,
							const ip6_addr_t *group,
							enum netif_mac_filter_action action);
static err_t xemacpsif_output(struct netif *netif, struct pbuf *p,
		const ip4_addr_t *ipaddr)
{
	/* resolve hardware address, then send (or queue) packet */
	return etharp_output(netif, p, (const ip4_addr_t*) ipaddr);
}
static err_t xemacpsif_mld6_mac_filter_update (struct netif *netif,
							const ip6_addr_t *group,
							enum netif_mac_filter_action action)
{
	u8_t temp_mask;
	unsigned int i;
	u8_t * ip_addr = (u8_t *) group;

	if(!(xemacpsif_ip6_addr_ismulticast((ip6_addr_t*) group ))) {
static void xemacpsif_mac_hash_update (struct netif *netif, u8_t *ip4_addr_t,
		enum netif_mac_filter_action action)
Dominant language
HTML
Stars
1.2k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Xilinx/embeddedsw

All issues in Xilinx/embeddedsw

Similar issues

More Networking issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.