diff mbox

libnet: Move the external declaration of send_ip to ethernet.h

Message ID 1499345774-30845-1-git-send-email-thuth@redhat.com
State Accepted
Headers show

Commit Message

Thomas Huth July 6, 2017, 12:56 p.m. UTC
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@redhat.com>
---
 lib/libnet/ethernet.h | 3 +++
 lib/libnet/ipv4.h     | 2 --
 lib/libnet/ipv6.h     | 2 --
 3 files changed, 3 insertions(+), 4 deletions(-)

Comments

Nikunj A Dadhania July 7, 2017, 4:36 a.m. UTC | #1
Thomas Huth <thuth@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@redhat.com>

Reviewed-by: Nikunj A Dadhania <nikunj@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@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/slof
Alexey Kardashevskiy July 7, 2017, 6:45 a.m. UTC | #2
On 06/07/17 22:56, Thomas Huth wrote:
> 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.
> 

Thanks, applied.

> Signed-off-by: Thomas Huth <thuth@redhat.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;
>  
>
diff mbox

Patch

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;