Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fou: make local function static

The build header functions are not used by any other code.

net/ipv6/fou6.c:36:5: warning: no previous prototype for ‘fou6_build_header’ [-Wmissing-prototypes]
net/ipv6/fou6.c:54:5: warning: no previous prototype for ‘gue6_build_header’ [-Wmissing-prototypes]

Need to do some code rearranging to satisfy different Kconfig possiblities.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

stephen hemminger and committed by
David S. Miller
9dc621af c718c6d6

+47 -49
+41 -41
net/ipv4/fou.c
··· 8 8 #include <linux/kernel.h> 9 9 #include <net/genetlink.h> 10 10 #include <net/gue.h> 11 + #include <net/fou.h> 11 12 #include <net/ip.h> 12 13 #include <net/protocol.h> 13 14 #include <net/udp.h> ··· 860 859 } 861 860 EXPORT_SYMBOL(gue_encap_hlen); 862 861 863 - static void fou_build_udp(struct sk_buff *skb, struct ip_tunnel_encap *e, 864 - struct flowi4 *fl4, u8 *protocol, __be16 sport) 865 - { 866 - struct udphdr *uh; 867 - 868 - skb_push(skb, sizeof(struct udphdr)); 869 - skb_reset_transport_header(skb); 870 - 871 - uh = udp_hdr(skb); 872 - 873 - uh->dest = e->dport; 874 - uh->source = sport; 875 - uh->len = htons(skb->len); 876 - udp_set_csum(!(e->flags & TUNNEL_ENCAP_FLAG_CSUM), skb, 877 - fl4->saddr, fl4->daddr, skb->len); 878 - 879 - *protocol = IPPROTO_UDP; 880 - } 881 - 882 862 int __fou_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, 883 863 u8 *protocol, __be16 *sport, int type) 884 864 { ··· 875 893 return 0; 876 894 } 877 895 EXPORT_SYMBOL(__fou_build_header); 878 - 879 - int fou_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, 880 - u8 *protocol, struct flowi4 *fl4) 881 - { 882 - int type = e->flags & TUNNEL_ENCAP_FLAG_CSUM ? SKB_GSO_UDP_TUNNEL_CSUM : 883 - SKB_GSO_UDP_TUNNEL; 884 - __be16 sport; 885 - int err; 886 - 887 - err = __fou_build_header(skb, e, protocol, &sport, type); 888 - if (err) 889 - return err; 890 - 891 - fou_build_udp(skb, e, fl4, protocol, sport); 892 - 893 - return 0; 894 - } 895 - EXPORT_SYMBOL(fou_build_header); 896 896 897 897 int __gue_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, 898 898 u8 *protocol, __be16 *sport, int type) ··· 949 985 } 950 986 EXPORT_SYMBOL(__gue_build_header); 951 987 952 - int gue_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, 953 - u8 *protocol, struct flowi4 *fl4) 988 + #ifdef CONFIG_NET_FOU_IP_TUNNELS 989 + 990 + static void fou_build_udp(struct sk_buff *skb, struct ip_tunnel_encap *e, 991 + struct flowi4 *fl4, u8 *protocol, __be16 sport) 992 + { 993 + struct udphdr *uh; 994 + 995 + skb_push(skb, sizeof(struct udphdr)); 996 + skb_reset_transport_header(skb); 997 + 998 + uh = udp_hdr(skb); 999 + 1000 + uh->dest = e->dport; 1001 + uh->source = sport; 1002 + uh->len = htons(skb->len); 1003 + udp_set_csum(!(e->flags & TUNNEL_ENCAP_FLAG_CSUM), skb, 1004 + fl4->saddr, fl4->daddr, skb->len); 1005 + 1006 + *protocol = IPPROTO_UDP; 1007 + } 1008 + 1009 + static int fou_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, 1010 + u8 *protocol, struct flowi4 *fl4) 1011 + { 1012 + int type = e->flags & TUNNEL_ENCAP_FLAG_CSUM ? SKB_GSO_UDP_TUNNEL_CSUM : 1013 + SKB_GSO_UDP_TUNNEL; 1014 + __be16 sport; 1015 + int err; 1016 + 1017 + err = __fou_build_header(skb, e, protocol, &sport, type); 1018 + if (err) 1019 + return err; 1020 + 1021 + fou_build_udp(skb, e, fl4, protocol, sport); 1022 + 1023 + return 0; 1024 + } 1025 + 1026 + static int gue_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, 1027 + u8 *protocol, struct flowi4 *fl4) 954 1028 { 955 1029 int type = e->flags & TUNNEL_ENCAP_FLAG_CSUM ? SKB_GSO_UDP_TUNNEL_CSUM : 956 1030 SKB_GSO_UDP_TUNNEL; ··· 1003 1001 1004 1002 return 0; 1005 1003 } 1006 - EXPORT_SYMBOL(gue_build_header); 1007 1004 1008 - #ifdef CONFIG_NET_FOU_IP_TUNNELS 1009 1005 1010 1006 static const struct ip_tunnel_encap_ops fou_iptun_ops = { 1011 1007 .encap_hlen = fou_encap_hlen,
+6 -8
net/ipv6/fou6.c
··· 14 14 #include <net/udp.h> 15 15 #include <net/udp_tunnel.h> 16 16 17 + #if IS_ENABLED(CONFIG_IPV6_FOU_TUNNEL) 18 + 17 19 static void fou6_build_udp(struct sk_buff *skb, struct ip_tunnel_encap *e, 18 20 struct flowi6 *fl6, u8 *protocol, __be16 sport) 19 21 { ··· 35 33 *protocol = IPPROTO_UDP; 36 34 } 37 35 38 - int fou6_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, 39 - u8 *protocol, struct flowi6 *fl6) 36 + static int fou6_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, 37 + u8 *protocol, struct flowi6 *fl6) 40 38 { 41 39 __be16 sport; 42 40 int err; ··· 51 49 52 50 return 0; 53 51 } 54 - EXPORT_SYMBOL(fou6_build_header); 55 52 56 - int gue6_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, 57 - u8 *protocol, struct flowi6 *fl6) 53 + static int gue6_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, 54 + u8 *protocol, struct flowi6 *fl6) 58 55 { 59 56 __be16 sport; 60 57 int err; ··· 68 67 69 68 return 0; 70 69 } 71 - EXPORT_SYMBOL(gue6_build_header); 72 - 73 - #if IS_ENABLED(CONFIG_IPV6_FOU_TUNNEL) 74 70 75 71 static const struct ip6_tnl_encap_ops fou_ip6tun_ops = { 76 72 .encap_hlen = fou_encap_hlen,