Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails to compile on recent kernel: error: 'struct nf_bridge_info' has no member named 'physindev #232

Open
solsticedhiver opened this issue Jun 30, 2024 · 0 comments

Comments

@solsticedhiver
Copy link

I am trying to build the module on lts 6.1.96, x86_64

It works fine, but if you enable --enable-physdev, it throws an error:

$ ./configure --enable-physdev 
Module version: 2.6-17-g0eb2092
Kernel version: 6.1.96-1-lts61 (uname)
Kernel sources: /lib/modules/6.1.96-1-lts61/build (found)
Checking for presence of include/linux/netfilter.h... Yes
netfilter.h uses CONFIG_NF_NAT_NEEDED... No
Checking for presence of include/linux/llist.h... Yes
Checking for presence of include/linux/grsecurity.h... No
Iptables binary version: 1.8.10 (nf_tables) (detected from /usr/bin/iptables)
pkg-config for version 1.8.10 (nf_tables) exists: No (reported: 1.8.10)
Check for working gcc: Yes (gcc)
Checking for presence of xtables.h... Yes
Searching for iptables-1.8.10 (nf_tables) sources..
! Can not find iptables source directory, you may try setting it with --ipt-src=
! This is not fatal error, yet. Will be just using default include dir.
Iptables include flags: none (default)
Iptables module path: /usr/lib/xtables (from libxtables.so, from binary)
Searching for net-snmp-config... Yes /usr/bin/net-snmp-config
Searching for net-snmp agent... No.
 Assuming you don't want net-snmp agent support.
 Otherwise install net-snmp (www.net-snmp.org)
Checking for DKMS... No. (It may be useful to install it.)
! 
! DKMS is method of installing kernel modules, that will
! automatically recompile module after kernel upgrade.
Creating Makefile.. done.

  If you need some options enabled run ./configure --help
  Now run: make all install

$ make
./gen_compat_def > compat_def.h-
Test function xt_family linux/netfilter_ipv4/ip_tables.h  declared
Test struct timeval linux/ktime.h  undeclared
egrep: warning: egrep is obsolescent; using grep -E
Test struct proc_ops linux/proc_fs.h  declared
Test function synchronize_sched linux/rcupdate.h  undeclared
egrep: warning: egrep is obsolescent; using grep -E
Test function nf_bridge_info_get linux/netfilter_bridge.h  declared
Test struct vlan_dev_priv linux/if_vlan.h  undeclared
egrep: warning: egrep is obsolescent; using grep -E
Test function put_unaligned_be24 asm/unaligned.h  declared
Test function totalram_pages linux/mm.h  declared
Test symbol totalram_pages linux/mm.h  declared
Test member nf_ct_event_notifier.ct_event net/netfilter/nf_conntrack_ecache.h  declared
Test function register_sysctl_paths linux/sysctl.h  declared
mv compat_def.h- compat_def.h
Compiling 2.6-17-g0eb2092 for kernel 6.1.96-1-lts61
make -C /lib/modules/6.1.96-1-lts61/build M=/home/solstice/prog/dvcs/ipt-netflow modules
  CC [M]  /home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.o
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c: In function 'netflow_target':
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:5301:40: error: 'struct nf_bridge_info' has no member named 'physindev'; did you mean 'physinif'?
 5301 |                 copy_dev(nf->i_ifphys, physindev, if_in);
      |                                        ^~~~~~~~~
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:5295:73: note: in definition of macro 'copy_dev'
 5295 |                 if (nf_bridge_info_get(skb) && nf_bridge_info_get(skb)->physdev) \
      |                                                                         ^~~~~~~
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:5301:40: error: 'struct nf_bridge_info' has no member named 'physindev'; did you mean 'physinif'?
 5301 |                 copy_dev(nf->i_ifphys, physindev, if_in);
      |                                        ^~~~~~~~~
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:5291:30: note: in definition of macro 'resolve_snmp'
 5291 | # define resolve_snmp(dev) ((dev)? (dev)->ifindex : -1)
      |                              ^~~
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:5301:17: note: in expansion of macro 'copy_dev'
 5301 |                 copy_dev(nf->i_ifphys, physindev, if_in);
      |                 ^~~~~~~~
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:5301:40: error: 'struct nf_bridge_info' has no member named 'physindev'; did you mean 'physinif'?
 5301 |                 copy_dev(nf->i_ifphys, physindev, if_in);
      |                                        ^~~~~~~~~
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:5291:37: note: in definition of macro 'resolve_snmp'
 5291 | # define resolve_snmp(dev) ((dev)? (dev)->ifindex : -1)
      |                                     ^~~
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:5301:17: note: in expansion of macro 'copy_dev'
 5301 |                 copy_dev(nf->i_ifphys, physindev, if_in);
      |                 ^~~~~~~~
make[2]: *** [scripts/Makefile.build:250: /home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.o] Error 1
make[1]: *** [Makefile:2009: /home/solstice/prog/dvcs/ipt-netflow] Error 2
make: *** [Makefile:27: ipt_NETFLOW.ko] Error 2

Recent changes in kernel api have deprecated physindev

On master branch of linux kernel, this was done in commit 9874808878d9eed407e3977fd11fee49de1e1d86 "netfilter: bridge: replace physindev with physinif in nf_bridge_info"

same problem on archlinuxarm with kernel 6.6.35-1-rpi on rpi3 (armv7h, 32 bit)

If you enable all options, you get other error about printf format:

./configure --enable-natevents --enable-snmp-rules --enable-macaddress --enable-vlan --enable-direction --enable-sampler --enable-physdev --enable-promisc --promisc-mpls
$ make
./gen_compat_def > compat_def.h-
Test function xt_family linux/netfilter_ipv4/ip_tables.h  declared
Test struct timeval linux/ktime.h  undeclared
egrep: warning: egrep is obsolescent; using grep -E
Test struct proc_ops linux/proc_fs.h  declared
Test function synchronize_sched linux/rcupdate.h  undeclared
egrep: warning: egrep is obsolescent; using grep -E
Test function nf_bridge_info_get linux/netfilter_bridge.h  declared
Test struct vlan_dev_priv linux/if_vlan.h  undeclared
egrep: warning: egrep is obsolescent; using grep -E
Test function put_unaligned_be24 asm/unaligned.h  declared
Test function totalram_pages linux/mm.h  declared
Test symbol totalram_pages linux/mm.h  declared
Test member nf_ct_event_notifier.ct_event net/netfilter/nf_conntrack_ecache.h  declared
Test function register_sysctl_paths linux/sysctl.h  declared
mv compat_def.h- compat_def.h
Compiling 2.6-17-g0eb2092 for kernel 6.1.96-1-lts61
make -C /lib/modules/6.1.96-1-lts61/build M=/home/solstice/prog/dvcs/ipt-netflow modules
  CC [M]  /home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.o
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c: In function 'nf_seq_show':
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:762:60: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 's64' {aka 'long long int'} [-Wformat=]
  762 |                         seq_printf(seq, " Flows selected %lu, discarded %lu.",
      |                                                          ~~^
      |                                                            |
      |                                                            long unsigned int
      |                                                          %llu
  763 |                             atomic64_read(&flows_selected),
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
      |                             |
      |                             s64 {aka long long int}
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:762:75: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 's64' {aka 'long long int'} [-Wformat=]
  762 |                         seq_printf(seq, " Flows selected %lu, discarded %lu.",
      |                                                                         ~~^
      |                                                                           |
      |                                                                           long unsigned int
      |                                                                         %llu
  763 |                             atomic64_read(&flows_selected),
  764 |                             atomic64_read(&flows_observed) - atomic64_read(&flows_selected));
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                            |
      |                                                            s64 {aka long long int}
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:766:60: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 's64' {aka 'long long int'} [-Wformat=]
  766 |                         seq_printf(seq, " Flows selected %lu.", atomic64_read(&flows_selected));
      |                                                          ~~^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                            |    |
      |                                                            |    s64 {aka long long int}
      |                                                            long unsigned int
      |                                                          %llu
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c: In function 'netflow_target':
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:5301:40: error: 'struct nf_bridge_info' has no member named 'physindev'; did you mean 'physinif'?
 5301 |                 copy_dev(nf->i_ifphys, physindev, if_in);
      |                                        ^~~~~~~~~
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:5295:73: note: in definition of macro 'copy_dev'
 5295 |                 if (nf_bridge_info_get(skb) && nf_bridge_info_get(skb)->physdev) \
      |                                                                         ^~~~~~~
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:5301:40: error: 'struct nf_bridge_info' has no member named 'physindev'; did you mean 'physinif'?
 5301 |                 copy_dev(nf->i_ifphys, physindev, if_in);
      |                                        ^~~~~~~~~
/home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.c:5296:69: note: in definition of macro 'copy_dev'
 5296 |                         out = resolve_snmp(nf_bridge_info_get(skb)->physdev); \
      |                                                                     ^~~~~~~
make[2]: *** [scripts/Makefile.build:250: /home/solstice/prog/dvcs/ipt-netflow/ipt_NETFLOW.o] Error 1
make[1]: *** [Makefile:2009: /home/solstice/prog/dvcs/ipt-netflow] Error 2
make: *** [Makefile:27: ipt_NETFLOW.ko] Error 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant