[SLOF] [PATCH] libnet: Move the external declaration of send_ip to ethernet.h

Nikunj A Dadhania nikunj at linux.vnet.ibm.com
Fri Jul 7 14:36:40 AEST 2017


Thomas Huth <thuth at redhat.com> writes:

> When compiling SLOF with the -Wredundant-decls compiler flag,
> there is currently a warning in the libnet code since the send_ip
> pointer is currently declared twice, one time in ipv4.h and
> one time in ipv6.h. To avoid this warning, let's move the
> declaration to IP-version independent ethernet.h instead.
>
> Signed-off-by: Thomas Huth <thuth at redhat.com>

Reviewed-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>

> ---
>  lib/libnet/ethernet.h | 3 +++
>  lib/libnet/ipv4.h     | 2 --
>  lib/libnet/ipv6.h     | 2 --
>  3 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/lib/libnet/ethernet.h b/lib/libnet/ethernet.h
> index e541c8f..a09e365 100644
> --- a/lib/libnet/ethernet.h
> +++ b/lib/libnet/ethernet.h
> @@ -44,4 +44,7 @@ extern int send_ether(int fd, void* buffer, int len);
>  extern void fill_ethhdr(uint8_t * packet, uint16_t eth_type,
>                          const uint8_t * src_mac, const uint8_t * dest_mac);
>  
> +/* Points either to send_ipv4() or send_ipv6() */
> +extern int (*send_ip)(int fd, void *, int);
> +
>  #endif
> diff --git a/lib/libnet/ipv4.h b/lib/libnet/ipv4.h
> index 5717c9a..3220ab5 100644
> --- a/lib/libnet/ipv4.h
> +++ b/lib/libnet/ipv4.h
> @@ -71,8 +71,6 @@ extern void     set_ipv4_netmask(uint32_t subnet_mask);
>  extern uint32_t get_ipv4_netmask(void);
>  extern uint32_t get_default_ipv4_netmask(char *ip_addr);
>  
> -extern int   (*send_ip) (int fd, void *, int);
> -
>  /* fills ip header */
>  extern void fill_iphdr(uint8_t * packet, uint16_t packetsize,
>                         uint8_t ip_proto, uint32_t ip_src, uint32_t ip_dst);
> diff --git a/lib/libnet/ipv6.h b/lib/libnet/ipv6.h
> index 6f783b3..7b71b50 100644
> --- a/lib/libnet/ipv6.h
> +++ b/lib/libnet/ipv6.h
> @@ -130,8 +130,6 @@ struct ip6_config {
>  };
>  
>  /******************** VARIABLES **********************************************/
> -/* Function pointer send_ip. Points either to send_ipv4() or send_ipv6() */
> -extern int   (*send_ip) (int fd, void *, int);
>  
>  extern struct ip6_config ip6_state;
>  
> -- 
> 1.8.3.1
>
> _______________________________________________
> SLOF mailing list
> SLOF at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/slof



More information about the SLOF mailing list