Re: [PATCH bpf-next v2 3/6] net: remove duplicate reuseport_lookup functions

From: Simon Horman
Date: Thu Jun 15 2023 - 03:22:59 EST


On Wed, Jun 14, 2023 at 04:42:45PM +0100, Lorenz Bauer wrote:
> On Tue, Jun 13, 2023 at 4:33 PM Simon Horman <simon.horman@xxxxxxxxxxxx> wrote:
> > >
> > > +INDIRECT_CALLABLE_DECLARE(u32 udp_ehashfn(const struct net *,
> > > + const __be32, const __u16,
> > > + const __be32, const __be16));
> > > +
> >
> > Hi Lorenz,
> >
> > Would this be better placed in a header file?
> > GCC complains that in udp.c this function is neither static nor
> > has a prototype.
>
> Hi Simon,
>
> The problem is that I don't want to pull in udp.h in
> inet_hashtables.c, but that is the natural place to define that
> function. I was hoping the macro magic would solve the problem, but oh
> well. How do you make gcc complain, and what is the full error
> message?

Hi Lorenz,

sorry for the bother.

With gcc 12.3.0 [1] on x86_64 I see:

$ make allmodconfig
$ make W=1 net/ipv4/udp.o
net/ipv4/udp.c:410:5: error: no previous prototype for 'udp_ehashfn' [-Werror=missing-prototypes]
410 | u32 udp_ehashfn(const struct net *net, const __be32 laddr, const __u16 lport,
| ^~~~~~~~~~~

[1] https://mirrors.edge.kernel.org/pub/tools/crosstool/