IMQ@NAT kernel modul issue

If your problem doesn't fall into one of the other categories, report it here.

Moderator: Moderators

ispyisail
Moderator
Posts: 4654
Joined: Mon Apr 06, 2009 3:15 am
Location: New Zealand

Re: IMQ@NAT kernel modul issue

Postby ispyisail » Sat May 18, 2019 10:00 pm

@Lantis

Comments like these are quite frankly self entitled and disrespectful.


yeah

tester
Posts: 15
Joined: Wed May 08, 2019 4:15 pm

Re: IMQ@NAT kernel modul issue

Postby tester » Tue May 21, 2019 1:16 pm

Lantis wrote:It isn’t as straight forward as comparing the two.


For example:

Code: Select all

imq.c original:
static int __net_init imq_init_hooks(void)
{

yours:
static int __init imq_init_hooks(void)
{


Code: Select all

nf_queue.c original:
 {
    int status = -ENOENT;
    struct nf_queue_entry *entry = NULL;
    const struct nf_afinfo *afinfo;
    const struct nf_queue_handler *qh;
    struct net *net = state->net;

yours:
 {
    int status = -ENOENT;
    struct nf_queue_entry *entry = NULL;
    const struct nf_queue_handler *qh;
    struct net *net = state->net;
    unsigned int route_key_size;


Is this correct differences?

User avatar
RomanHK
Posts: 405
Joined: Sat May 04, 2013 4:18 pm
Location: Czech Republik

Re: IMQ@NAT kernel modul issue

Postby RomanHK » Tue May 21, 2019 1:28 pm

Turris Omnia with Gargoyle 1.11.x
Linksys WRT3200ACM with Gargoyle 1.11.x
TL-WR1043ND v2 with Gargoyle 1.10.0

Lantis
Moderator
Posts: 5092
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: IMQ@NAT kernel modul issue

Postby Lantis » Tue May 21, 2019 5:08 pm

Their patch isn’t suitable as it is.
The init/netinit doesn’t appear to make a difference.

Just try the fix I already put up days ago.
Routers: Various ar71xx/mvebu/x86-64
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases

User avatar
RomanHK
Posts: 405
Joined: Sat May 04, 2013 4:18 pm
Location: Czech Republik

Re: IMQ@NAT kernel modul issue

Postby RomanHK » Wed May 22, 2019 3:43 am

Tested version: 1.11.X (Built 20190519-0727 git@5834a1ca)

I've noticed a new version of IMQ driver:

Code: Select all

IMQv4: Hooking IMQ after mangle on PREROUTING, pf=2, hooknum=0, priority=-149
IMQv6: Hooking IMQ after mangle on PREROUTING, pf=10, hooknum=0, priority=-149
IMQv4: Hooking IMQ after nat on POSTROUTING, pf=2, hooknum=4, priority=101
IMQv6: Hooking IMQ after nat on POSTROUTING, pf=10, hooknum=4, priority=101
IMQ driver loaded successfully. (numdevs = 2, numqueues = 1, imq_dev_accurate_stats = 1)

However, the error loading the iptable_nat kernel module still remains :cry: .
Turris Omnia with Gargoyle 1.11.x
Linksys WRT3200ACM with Gargoyle 1.11.x
TL-WR1043ND v2 with Gargoyle 1.10.0

Lantis
Moderator
Posts: 5092
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: IMQ@NAT kernel modul issue

Postby Lantis » Wed May 22, 2019 5:59 am

I didn’t say it would.
If you want it solved you’ll need to come up with a solution and post it to me because I can’t produce the error at will.

Remaining options (in order of preference):
1. Sooner or later start order of IMQ
2. Change parameters of IMQ start
3. Don’t load IMQ at all (until needed by the firewall). I’d only allow 3 if it did not ruin any other functionality.

For point 2, you can also try avoiding the NAT hook when it loads to see if that makes a difference.
Modify the file that loads IMQ to include the following parameters:
numdevs=1 hook_chains="INPUT,FORWARD" hook_tables="mangle,mangle"
Routers: Various ar71xx/mvebu/x86-64
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases

User avatar
RomanHK
Posts: 405
Joined: Sat May 04, 2013 4:18 pm
Location: Czech Republik

Re: IMQ@NAT kernel modul issue

Postby RomanHK » Wed May 22, 2019 1:30 pm

So it is really annoying. Maybe we'll find it out in time.

1. I found that changing the priority is meaningless (/tmp/overlay/upper/etc/modules.d/* is missing), it was a mistake :oops: :

Code: Select all

[3.496380] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[3.554450] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[7.282533] kmodloader: loading kernel modules from //etc/modules-boot.d/*
[7.289923] kmodloader: done loading kernel modules from //etc/modules-boot.d/*
[8.098607] kmodloader: loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
[8.163266] kmodloader: done loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
[9.888800] kmodloader: loading kernel modules from /etc/modules.d/*
[15.674480] kmodloader: done loading kernel modules from /etc/modules.d/*
I can only prioritize by creating a link in /etc/modules-boot.d/. Even in this way, the error sometimes occurs.

2. I don't know how I could change the startup parameters when I load the kernel modules /sbin/kmodloader with the program or use the modprobe command.

3. That's good for me because I don't use QoS, but what about other users? In any case, the Gargoyle's inoperative service - I don't see it as a good solution.
Last edited by RomanHK on Wed May 22, 2019 1:48 pm, edited 1 time in total.
Turris Omnia with Gargoyle 1.11.x
Linksys WRT3200ACM with Gargoyle 1.11.x
TL-WR1043ND v2 with Gargoyle 1.10.0

User avatar
RomanHK
Posts: 405
Joined: Sat May 04, 2013 4:18 pm
Location: Czech Republik

Re: IMQ@NAT kernel modul issue

Postby RomanHK » Wed May 22, 2019 1:36 pm

As a working solution, I have modified /etc/init.d/boot as follows:

Code: Select all

#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org

START=10
STOP=98

uci_apply_defaults() {
   . /lib/functions/system.sh

   cd /etc/uci-defaults || return 0
   files="$(ls)"
   [ -z "$files" ] && return 0
   mkdir -p /tmp/.uci
   for file in $files; do
      ( . "./$(basename $file)" ) && rm -f "$file"
   done
   uci commit
}

boot() {
   [ -f /proc/mounts ] || /sbin/mount_root
   [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
   [ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD

   mkdir -p /var/run
   mkdir -p /var/log
   mkdir -p /var/lock
   mkdir -p /var/state
   mkdir -p /var/tmp
   mkdir -p /tmp/.uci
   chmod 0700 /tmp/.uci
   touch /var/log/wtmp
   touch /var/log/lastlog
   touch /tmp/resolv.conf.auto
   ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf
   grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
   [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe

   /sbin/kmodloader

   # IMQ@NAT kernel modul issue
   [ -z `cat /proc/net/ip_tables_names | grep nat` ] && reboot -f

   [ ! -f /etc/config/wireless ] && {
      # compat for brcm47xx and mvebu
      sleep 1
   }

   /bin/config_generate
   uci_apply_defaults
   
   # temporary hack until configd exists
   /sbin/reload_config
}


These are lines 41 and 42:

Code: Select all

# IMQ@NAT kernel modul issue
[ -z `cat /proc/net/ip_tables_names | grep nat` ] && reboot -f

I already use this method for a month, so far without errors.

Yes, 1% of users may find that the router loops, but what is important to us? Those who do not have a problem with IMQ@NAT are not affected.
Turris Omnia with Gargoyle 1.11.x
Linksys WRT3200ACM with Gargoyle 1.11.x
TL-WR1043ND v2 with Gargoyle 1.10.0

Lantis
Moderator
Posts: 5092
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: IMQ@NAT kernel modul issue

Postby Lantis » Wed May 22, 2019 5:40 pm

You can adjust the file at /etc/modules.d/46-it-imq and add the parameters inside the file after the imq module name.
Routers: Various ar71xx/mvebu/x86-64
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases

User avatar
RomanHK
Posts: 405
Joined: Sat May 04, 2013 4:18 pm
Location: Czech Republik

Re: IMQ@NAT kernel modul issue

Postby RomanHK » Thu May 23, 2019 1:37 pm

Yes, the parameters seem to have helped me ;) . I'll test in a longer time interval. I'd like someone else to try.

Procedure:
1. copy the file from /etc/modules.d/46-ipt-imq to /etc/modules-boot.d/46-ipt-imq
2. Edit /etc/modules-boot.d/46-ipt-imq as follows:

Code: Select all

imq numdevs=1 hook_chains="INPUT,FORWARD" hook_tables="mangle,mangle"
xt_IMQ
3. Restart the router

Log output:

Code: Select all

kmodloader: loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
IMQv4: Hooking IMQ after mangle on INPUT, pf=2, hooknum=1, priority=-149
IMQv6: Hooking IMQ after mangle on INPUT, pf=10, hooknum=1, priority=-149
IMQv4: Hooking IMQ after mangle on FORWARD, pf=2, hooknum=2, priority=-149
IMQv6: Hooking IMQ after mangle on FORWARD, pf=10, hooknum=2, priority=-149
IMQ driver loaded successfully. (numdevs = 1, numqueues = 1, imq_dev_accurate_stats = 1)
kmodloader: done loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*

Question:
Will these parameters not interfere with Gargoyle's functionality (eg QoS)?
Turris Omnia with Gargoyle 1.11.x
Linksys WRT3200ACM with Gargoyle 1.11.x
TL-WR1043ND v2 with Gargoyle 1.10.0


Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 2 guests