Udhcpd config for tethering (fixing, maybe?)

UPDATE #1

After having applied this patch, the system continues to suffer of the problem and therefore I had to investigate the root cause. First of all, I started to play with the iptables and I discovered that the source and destination ports for offering the DHCP service are inverted, in that way the ports are for using the DHCP (client).

As you can see the second rule in the INPUT chain is the same which is set in connman-INPUT but the one that works for offering the service is the first. Both are necessary, obviously and thus I updated my patch as well.

    2   638 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp spt:68 dpt:67
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp spt:67 dpt:68

I am quite surprised to found out something like this because I cannot believe that nobody noticed before. Possibly, I am still overlooking something.


iptables investigation

iptables -nvL; iptables -nvL -t nat;

Chain INPUT (policy ACCEPT 46 packets, 3931 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    4  1312 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp spt:68 dpt:67
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp spt:67 dpt:68

Chain FORWARD (policy ACCEPT 1292 packets, 830K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 40 packets, 8071 bytes)
 pkts bytes target     prot opt in     out     source               destination         
 1250  157K connman-OUTPUT  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain connman-INPUT (0 references)
 pkts bytes target     prot opt in     out     source               destination         
    4   240 ACCEPT     tcp  --  tether *       0.0.0.0/0            0.0.0.0/0            tcp flags:0x17/0x02 multiport dports 22,2222
    0     0 ACCEPT     all  --  rndis0 *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     tcp  --  lo     *       0.0.0.0/0            0.0.0.0/0            tcp flags:0x17/0x02 multiport dports 22,2222
    0     0 DROP       tcp  --  !rndis0 *       0.0.0.0/0            0.0.0.0/0            tcp flags:0x17/0x02 multiport dports 22,2222
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp spt:67 dpt:68
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0            icmp !type 8 code 0
    0     0 ACCEPT     33   --  *      *       0.0.0.0/0            0.0.0.0/0            multiport dports 1024:65535
    0     0 ACCEPT     sctp --  *      *       0.0.0.0/0            0.0.0.0/0            multiport dports 1024:65535
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            multiport dports 1024:65535
    0     0 ACCEPT     udplite--  *      *       0.0.0.0/0            0.0.0.0/0            multiport dports 1024:65535
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            multiport dports 1024:65535
    0     0 ACCEPT     47   --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     esp  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     ah   --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
  374 31159 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED

Chain connman-OUTPUT (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  *      rndis0  0.0.0.0/0            0.0.0.0/0           
   81 11775 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0            icmp !type 0 code 0
Chain PREROUTING (policy ACCEPT 651 packets, 55779 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 123 packets, 11059 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 9 packets, 626 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 7758 packets, 493K bytes)
 pkts bytes target     prot opt in     out     source               destination         
  101  6824 connman-POSTROUTING  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain connman-POSTROUTING (1 references)
 pkts bytes target     prot opt in     out     source               destination         
   94  6340 MASQUERADE  all  --  *      rmnet_data1  172.28.172.0/24      0.0.0.0/0
1 Like