Re: Qualcomm "raw IP" mode (was Re: Huawei E398 cdc/serialmodem-ppp 3G/4G)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marcel Holtmann <marcel@xxxxxxxxxxxx> writes:

> As I said, there is only one address. And the is your IP address. The
> gateway is made up by the card.

Really?  How can it do that?  Just stealing addresses which it knows
will be in use by other clients?  That's not nice :-(

Anyway, as I said, this is done regardless of raw IP mode or not.  It's
not just DHCP.  You get the gateway address and netmask using the QMI
command as well, although you don't really need them as you correctly
point out.

Sample output when running in raw IP mode (0x1e is address, 0x20 is
gateway, 0x21 is netmask, 0x15 and 0x16 are DNS servers):

<= QMUX Header:
<=   len:    0x008e
<=   sender: 0x80
<=   svc:    0x01
<=   cid:    0x03

<= QMI Header:
<=   Flags:  0x02
<=   TXN:    0x0006
<=   Cmd:    0x002d
<=   Size:   0x0082
<= [0x02] ( 4) 00 00 00 00      SUCCESS - QMI_ERR_NONE
<= [0x10] ( 8) 70 72 6f 66 69 6c 65 31  profile1
<= [0x11] ( 1) 00       .
<= [0x14] (13) 70 69 6c 6f 74 2e 74 65 6c 65 6e 6f 72   pilot.telenor
<= [0x15] ( 4) 04 70 d5 c1      193.213.112.4
<= [0x16] ( 4) c6 0f 43 82      130.67.15.198
<= [0x17] (33) 04 f6 02 00 00 3e 03 00 00 01 00 00 00 01 00 00 00 02 dc 05 00 00 04 07 03 00 00 00 00 01 00 00 00       .....>...........................
<= [0x1d] ( 1) 00       .
<= [0x1e] ( 4) 1d 31 90 0a      10.144.49.29
<= [0x1f] ( 2) 00 01    ..
<= [0x20] ( 4) 1e 31 90 0a      10.144.49.30
<= [0x21] ( 4) fc ff ff ff      255.255.255.252
<= [0x22] ( 1) 00       .
<= [0x23] ( 1) 00       .
<= [0x24] ( 1) 00       .


This results in a virtual ethernet interface like this, faking ethernet:


bjorn@nemi:~$ ifconfig wwan1
wwan1     Link encap:Ethernet  HWaddr 00:a0:c6:00:00:00  
          inet addr:10.144.49.29  Bcast:10.144.49.31  Mask:255.255.255.252
          inet6 addr: fe80::2a0:c6ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:612 (612.0 B)  TX bytes:2244 (2.1 KiB)


Note that the NOARP flag means that there is no ARP, and that implies
that the netmask and gateway have no real meaning either.  Any packet
routed out this interface will be just blindly forwarded without any L2
address lookup.  So the netmask may mean something in the routing table,
but assuming that there is a default route out here as well, then it's
really pointless.

And the netmask and default route can be changed to anything I like,
even this:

 nemi:/home/bjorn# ifconfig wwan1 10.144.49.29 netmask 255.255.255.255 broadcast 10.144.49.29
 nemi:/home/bjorn# ip route add default dev wwan1

which works just fine, as expected:

 bjorn@nemi:~$ ip route get 193.0.0.193
 193.0.0.193 dev wwan1  src 10.144.49.29 
     cache  ipid 0xf49e

 bjorn@nemi:~$ ping -c3 193.0.0.193
 PING 193.0.0.193 (193.0.0.193) 56(84) bytes of data.
 64 bytes from 193.0.0.193: icmp_req=1 ttl=53 time=85.7 ms
 64 bytes from 193.0.0.193: icmp_req=2 ttl=53 time=92.2 ms
 64 bytes from 193.0.0.193: icmp_req=3 ttl=53 time=89.0 ms

 --- 193.0.0.193 ping statistics ---
 3 packets transmitted, 3 received, 0% packet loss, time 2002ms
 rtt min/avg/max/mdev = 85.798/89.051/92.276/2.655 ms


But there isn't really anything gained by that.  And we can do the same
thing with the device in "ethernet" mode.  Hmm, maybe we should set the
IFF_NOARP flag by default?  Anyway, testing is easy: ifconfig wwan1 -arp
works just as expected:  The device doesn't actually care about the MAC
addresses.

But this probably goes for any such modem.  I just tried the same with
the builtin Ericsson modem in this laptop.  After connecting and
configuring it with DHCP:

 nemi:/home/bjorn# ifconfig wwan0
 wwan0     Link encap:Ethernet  HWaddr 02:80:37:ec:02:00  
           inet addr:77.17.136.228  Bcast:77.17.136.231  Mask:255.255.255.248
           inet6 addr: fe80::80:37ff:feec:200/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:108 errors:0 dropped:0 overruns:0 frame:0
           TX packets:123 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000 
           RX bytes:10332 (10.0 KiB)  TX bytes:18114 (17.6 KiB)

Turn off ARP and change to /32 mask:

 nemi:/home/bjorn# ifconfig wwan0 -arp
 nemi:/home/bjorn# ifconfig wwan0 77.17.136.228 netmask 255.255.255.255 broadcast 77.17.136.228
 nemi:/home/bjorn# ip route add default dev wwan0
 nemi:/home/bjorn# ifconfig wwan0
 wwan0     Link encap:Ethernet  HWaddr 02:80:37:ec:02:00  
           inet addr:77.17.136.228  Bcast:77.17.136.228  Mask:255.255.255.255
           inet6 addr: fe80::80:37ff:feec:200/64 Scope:Link
           UP BROADCAST RUNNING NOARP MULTICAST  MTU:1500  Metric:1
           RX packets:121 errors:0 dropped:0 overruns:0 frame:0
           TX packets:139 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000 
           RX bytes:11611 (11.3 KiB)  TX bytes:19806 (19.3 KiB)


 bjorn@nemi:~$ ip route get 193.0.0.193
 193.0.0.193 dev wwan0  src 77.17.136.228 
     cache  ipid 0xf49e

 bjorn@nemi:~$ ping -c3 193.0.0.193
 PING 193.0.0.193 (193.0.0.193) 56(84) bytes of data.
 64 bytes from 193.0.0.193: icmp_req=1 ttl=54 time=81.4 ms
 64 bytes from 193.0.0.193: icmp_req=2 ttl=54 time=76.7 ms
 64 bytes from 193.0.0.193: icmp_req=3 ttl=54 time=79.5 ms
 
 --- 193.0.0.193 ping statistics ---
 3 packets transmitted, 3 received, 0% packet loss, time 2002ms
 rtt min/avg/max/mdev = 76.762/79.273/81.460/1.958 ms


So maybe all such devices should really have ARP turned off and have
NetworkManager automagically reconfigure to /32 masks with no gateway
address?

Or whatever.  It still doesn't make any argument for supporting the raw
IP mode of the Qualcomm modems.  As shown above, the addressing issue
can just as well be solved using the ethernet mode and not relying on
any driver changes.  And that goes for the Ericsson modem as well,
despite that being a completely different implementation.



Bjørn
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux