[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201902090750.tc7OlLPX%fengguang.wu@intel.com>
Date: Sat, 9 Feb 2019 07:20:35 +0800
From: kbuild test robot <lkp@...el.com>
To: Peter Oskolkov <posk@...gle.com>
Cc: kbuild-all@...org, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org,
Peter Oskolkov <posk@...k.io>, David Ahern <dsahern@...il.com>,
Willem de Bruijn <willemb@...gle.com>,
Peter Oskolkov <posk@...gle.com>
Subject: Re: [PATCH bpf-next v8 4/6] bpf: add handling of BPF_LWT_REROUTE to
lwt_bpf.c
Hi Peter,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on bpf-next/master]
url: https://github.com/0day-ci/linux/commits/Peter-Oskolkov/bpf-add-BPF_LWT_ENCAP_IP-option-to-bpf_lwt_push_encap/20190209-030743
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: x86_64-randconfig-j0-02040958 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
net//core/lwt_bpf.c: In function 'bpf_lwt_xmit_reroute':
>> net//core/lwt_bpf.c:216:10: warning: missing braces around initializer [-Wmissing-braces]
struct flowi4 fl4 = {0};
^
net//core/lwt_bpf.c:216:10: warning: (near initialization for 'fl4.__fl_common') [-Wmissing-braces]
vim +216 net//core/lwt_bpf.c
184
185 static int bpf_lwt_xmit_reroute(struct sk_buff *skb)
186 {
187 struct net_device *l3mdev = l3mdev_master_dev_rcu(skb_dst(skb)->dev);
188 int oif = l3mdev ? l3mdev->ifindex : 0;
189 struct dst_entry *dst = NULL;
190 struct sock *sk;
191 struct net *net;
192 bool ipv4;
193 int err;
194
195 if (skb->protocol == htons(ETH_P_IP)) {
196 ipv4 = true;
197 } else if (skb->protocol == htons(ETH_P_IPV6)) {
198 ipv4 = false;
199 } else {
200 pr_warn_once("BPF_LWT_REROUTE xmit: unsupported proto %d\n",
201 skb->protocol);
202 return -EINVAL;
203 }
204
205 sk = sk_to_full_sk(skb->sk);
206 if (sk) {
207 if (sk->sk_bound_dev_if)
208 oif = sk->sk_bound_dev_if;
209 net = sock_net(sk);
210 } else {
211 net = dev_net(skb_dst(skb)->dev);
212 }
213
214 if (ipv4) {
215 struct iphdr *iph = ip_hdr(skb);
> 216 struct flowi4 fl4 = {0};
217 struct rtable *rt;
218
219 fl4.flowi4_oif = oif;
220 fl4.flowi4_mark = skb->mark;
221 fl4.flowi4_uid = sock_net_uid(net, sk);
222 fl4.flowi4_tos = RT_TOS(iph->tos);
223 fl4.flowi4_flags = FLOWI_FLAG_ANYSRC;
224 fl4.flowi4_proto = iph->protocol;
225 fl4.daddr = iph->daddr;
226 fl4.saddr = iph->saddr;
227
228 rt = ip_route_output_key(net, &fl4);
229 if (IS_ERR(rt) || rt->dst.error)
230 return -EINVAL;
231 dst = &rt->dst;
232 } else {
233 #if IS_BUILTIN(CONFIG_IPV6)
234 struct ipv6hdr *iph6 = ipv6_hdr(skb);
235 struct flowi6 fl6 = {0};
236
237 fl6.flowi6_oif = oif;
238 fl6.flowi6_mark = skb->mark;
239 fl6.flowi6_uid = sock_net_uid(net, sk);
240 fl6.flowlabel = ip6_flowinfo(iph6);
241 fl6.flowi6_proto = iph6->nexthdr;
242 fl6.daddr = iph6->daddr;
243 fl6.saddr = iph6->saddr;
244
245 dst = ip6_route_output(net, skb->sk, &fl6);
246 if (IS_ERR(dst) || dst->error)
247 return -EINVAL;
248 #else
249 pr_warn_once("BPF_LWT_REROUTE xmit: IPV6 not built-in\n");
250 return -EINVAL;
251 #endif
252 }
253
254 /* Although skb header was reserved in bpf_lwt_push_ip_encap(), it
255 * was done for the previous dst, so we are doing it here again, in
256 * case the new dst needs much more space. The call below is a noop
257 * if there is enough header space in skb.
258 */
259 err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev));
260 if (unlikely(err))
261 return err;
262
263 skb_dst_drop(skb);
264 skb_dst_set(skb, dst);
265
266 err = dst_output(dev_net(skb_dst(skb)->dev), skb->sk, skb);
267 if (unlikely(err))
268 return err;
269
270 /* ip[6]_finish_output2 understand LWTUNNEL_XMIT_DONE */
271 return LWTUNNEL_XMIT_DONE;
272 }
273
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Download attachment ".config.gz" of type "application/gzip" (29197 bytes)
Powered by blists - more mailing lists