Skip to content

Commit

Permalink
Compatibility with kernel 5.7
Browse files Browse the repository at this point in the history
After commit a7afff31d56db22647251d76d6af030cd47bd97e "scsi: treewide: Consolidate
{get,put}_unaligned_[bl]e24() definitions", build fails due to:

...
  CC [M]  /home/ubuntu/ipt-netflow/iptables-netflow/ipt_NETFLOW.o
/home/ubuntu/ipt-netflow/iptables-netflow/ipt_NETFLOW.c:3518:20: error:
conflicting types for ‘put_unaligned_be24’
 3518 | static inline void put_unaligned_be24(u32 val, unsigned char *p)
      |                    ^~~~~~~~~~~~~~~~~~
In file included from ./arch/x86/include/asm/unaligned.h:10,
                 from ./include/linux/etherdevice.h:23,
                 from ./include/linux/if_vlan.h:11,
                 from ./include/linux/filter.h:22,
                 from ./include/net/sock.h:59,
                 from ./include/net/inet_sock.h:22,
                 from ./include/linux/udp.h:16,
                 from
/home/ubuntu/ipt-netflow/iptables-netflow/ipt_NETFLOW.c:32:
./include/linux/unaligned/generic.h:98:20: note: previous definition of
‘put_unaligned_be24’ was here
   98 | static inline void put_unaligned_be24(const u32 val, void *p)
...

Fix it by hiding the local version if Linux > 5.6

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
  • Loading branch information
piso77 authored and aabc committed May 20, 2020
1 parent 961641f commit 3ec192a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ipt_NETFLOW.c
Original file line number Diff line number Diff line change
Expand Up @@ -3515,11 +3515,13 @@ static inline __u8 hook2dir(const __u8 hooknum)
}
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(5,7,0)
static inline void put_unaligned_be24(u32 val, unsigned char *p)
{
*p++ = val >> 16;
put_unaligned_be16(val, p);
}
#endif

static struct {
s64 ms; /* this much abs milliseconds */
Expand Down

1 comment on commit 3ec192a

@jer-gentoo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's time for a 2.6 release. :-)

Please sign in to comment.