Re: [PATCH bpf-next 3/4] bpf: Add BPF_FIB_LOOKUP_SKIP_NEIGH for bpf_fib_lookup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/17/23 8:00 AM, Daniel Borkmann wrote:
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 1503f61336b6..6c1956e36c97 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
[...]
@@ -5838,21 +5836,28 @@ static int bpf_ipv4_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
      if (likely(nhc->nhc_gw_family != AF_INET6)) {
          if (nhc->nhc_gw_family)
              params->ipv4_dst = nhc->nhc_gw.ipv4;
-
-        neigh = __ipv4_neigh_lookup_noref(dev,
-                         (__force u32)params->ipv4_dst);
      } else {
          struct in6_addr *dst = (struct in6_addr *)params->ipv6_dst;
          params->family = AF_INET6;
          *dst = nhc->nhc_gw.ipv6;
-        neigh = __ipv6_neigh_lookup_noref_stub(dev, dst);
      }
+    if (flags & BPF_FIB_LOOKUP_SKIP_NEIGH)
+        goto set_fwd_params;
+
+    if (params->family == AF_INET6)

Nit, would have probably more intuitive to keep the same test also here
(nhc->nhc_gw_family != AF_INET6), but either way, lgtm.

Ack.


Are you still required to fill the params->smac in bpf_fib_set_fwd_params()
in that case, meaning, shouldn't bpf_redirect_neigh() take care of it as well
from neigh_output()? Looks unnecessary and could be moved out too.

Good point. will move it out from bpf_fib_set_fwd_params also. Thanks for the review.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux