iptables setup for mobile broadband ppp0 fails in r35916

Post new topic   Reply to topic    DD-WRT Forum Index -> X86 based Hardware
Author Message
hackler756
DD-WRT User


Joined: 17 Sep 2014
Posts: 68
Location: Austria

PostPosted: Sat May 12, 2018 6:38    Post subject: iptables setup for mobile broadband ppp0 fails in r35916 Reply with quote
x86_64 - hardware intel SS4200 - mobile broadband - no internet access

retested in r35916
Bad argument `178.113.171.145'
Error occurred at line: 5
Try `iptables-restore -h' or 'iptables-restore --help' for more information.

since release 12-04-2017-r33986 ip-tables setup fails for mobile broadband devices with interface ppp0

line from .ipt with 11-16-2017-r33772
-A PREROUTING -i ! ppp0 -d 178.113.195.231 -j MARK --set-mark 0x80000000/0x80000000
--> working

same config 12-04-2017-r33986
-A PREROUTING -i ! -d 77.118.133.144 -j MARK --set-mark 0x80000000/0x80000000

Bad argument '77.118.133.144'
Error occurred at line: 5
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
--> not working - obviously since interface is missing

this is the first example - there are several other lines in .ipt affected.

After some digging and tracing in firewall.c which generates .ipt, the issue was introduced with r33825:
in file libutils/utils.c - function char *get_wan_face(void)

nvram get wan_proto ==> 3g
nvram get 3gdata ==> /dev/usb/tts/0
nvram get pppd_pppifname ==> ppp0

r33622 - returns ppp0
Code:
#ifdef HAVE_3G
        else if (nvram_match("wan_proto", "3g")) {
                if (nvram_match("3gdata", "qmi")) {
                        strncpy(localwanface, "wwan0", IFNAMSIZ);
                } else {
                        if (nvram_match("pppd_pppifname", ""))
                                strncpy(localwanface, "ppp0", IFNAMSIZ);
                        else
                                strncpy(localwanface, nvram_safe_get("pppd_pppifname"), IFNAMSIZ);
                }
        }
#endif


r33825 - not working - returns null for ppp0
Code:
#ifdef HAVE_3G
        else if (nvram_match("wan_proto", "3g")) {
                if (nvram_match("3gdata", "mbim")) {
                        strncpy(localwanface, "wwan0", IFNAMSIZ);
                } else if (nvram_match("3gdata", "qmi")) {
                        strncpy(localwanface, "wwan0", IFNAMSIZ);
                } else if (nvram_match("3gdata", "sierradirectip")) {
                        strncpy(localwanface, "wwan0", IFNAMSIZ);
                        if (nvram_match("pppd_pppifname", ""))
                                strncpy(localwanface, "ppp0", IFNAMSIZ);
                        else
                                strncpy(localwanface, nvram_safe_get("pppd_pppifname"), IFNAMSIZ);
                }

        }
#endif


fix - seperate else block for ppp0
Code:
#ifdef HAVE_3G
        else if (nvram_match("wan_proto", "3g")) {
                if (nvram_match("3gdata", "mbim")) {
                        strncpy(localwanface, "wwan0", IFNAMSIZ);
                } else if (nvram_match("3gdata", "qmi")) {
                        strncpy(localwanface, "wwan0", IFNAMSIZ);
                } else if (nvram_match("3gdata", "sierradirectip")) {
                        strncpy(localwanface, "wwan0", IFNAMSIZ);
                } else {
                        if (nvram_match("pppd_pppifname", ""))
                                strncpy(localwanface, "ppp0", IFNAMSIZ);
                        else
                                strncpy(localwanface, nvram_safe_get("pppd_pppifname"), IFNAMSIZ);
                }

        }
#endif



patch
Code:
--- utils.c     (revision 35919)
+++ utils.c     (working copy)
@@ -1888,6 +1888,7 @@
                        strncpy(localwanface, "wwan0", IFNAMSIZ);
                } else if (nvram_match("3gdata", "sierradirectip")) {
                        strncpy(localwanface, "wwan0", IFNAMSIZ);
+               } else {
                        if (nvram_match("pppd_pppifname", ""))
                                strncpy(localwanface, "ppp0", IFNAMSIZ);
                        else


the interface for the modems is still ppp0 in the recent release 04-26-2018-r35831 - they are serial & qmi: E372 and DWM-222 A1

unfortunately it's time to tell the geniuses how to properly write an if else statement.
this is an annoying beginners mistake - happens to the best though Smile
Sponsor
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> X86 based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum