Hi Patrik, On 10/13/2015 11:32 AM, Patrik Flykt wrote:
> Hi, > > On Tue, 2015-10-13 at 08:49 +0000, John Ernberg wrote: > >> ConnMan runs on the embedded system, which is the USB host side. >> And when an USB gadget connects, I want to start a DHCP server on the >> interface provided by cdc_ether so that the USB gadget that connects >> can receive an IP by using a DHCP client. > USB host side is counted as a regular ethernet. So 'ethernet' tethering > is the one you want to configure. > >> I have parts of the file system as read only, so ConnMan does not >> remember things between reboots. > ConnMan stores its technology state into /var/lib/connman/settings, if > this file is not perserved over reboots maybe tmpfiles from systemd can > create a suitable one into that directory? Or some other shell scripting > during boot. I made a ramdisk out of /var/ when I made the file system read only. Nothing is however preserved after a reboot, and that has not been problem for me yet. >>> The networks that show up as services are the ones where ConnMan is a >>> end host/client. Tethering creates a local network bridge, 'tether', and >>> starts a DHCP server on it. The tethered network does not show up as a >>> service, as it is not an upstream connection. >> Ok, got it. I found the tether interface, the USB gadget side does not >> receive an IP however. > In the USB client/gadget end, especially when running Linux also here, > it usually is a matter of being able to (automatically) load the proper > drivers for the gadget device. It also is a matter of USB client mode > setting, the USB client/gadget is probably registered automatically for > some other (Linux kernel module) profile instead of networking. I attached some dumps at the bottom, because after 10 minutes I have still not received an IP on the USB gadget end. I made sure that the USB host side loaded cdc_ether and that the USB gadget side loaded g_ether. >> Could this be caused by that we do not always have any other active >> connections? > The upstream connections in ConnMan, i.e. services, do not need to be > enabled for thethering to work. Only routing/internet connectivity is > affected by the presence or absence of a connected service. > >> I.e. should this be done differently if I want to have a connection >> that is end-to-end, without bridging? > The connection between the USB host device running ConnMan and the other > device with the USB client connection already provide an end-to-end > connection over IP. If ConnMan has an service connected providing an > upstream internet connection, ConnMan sets up a NAT to get the tethered > devices connecting to the internet. The brigde interface comes into play > as it is the smartest way of connecting all tethering technologies and > interfaces into one network served by a single DHCP server. On the > winning side all devices tethered can now connect to each other via IP, > be they connected via Bluetooth, USB, ethernet or wifi. If I have other services that reach the internet, and possibly want to tether on these in the future, but want to keep this link private (not share it with the other connections). Would this then be out of scope for what ConnMan is designed for? > > Cheers, > > Patrik > > _______________________________________________ > connman mailing list > connman@connman.net > https://lists.connman.net/mailman/listinfo/connman Thank you and best regards // John Ernberg I had to obfuscate the MAC addresses, but it should still give a picture of what the setup looks like. Our cdc_ether driver publishes the Ethernet-over-USB interface as usb0, and shows up in ConnMan as a gadget technology. USB Host side: eth0 Link encap:Ethernet HWaddr yy:yy:yy:yy:yy:yy UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) tether Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::d838:94ff:fe48:389b/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:5 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:364 (364.0 B) TX bytes:620 (620.0 B) usb0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx inet6 addr: fe80::ff:fe02:1201/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:11 errors:0 dropped:0 overruns:0 frame:0 TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:748 (748.0 B) TX bytes:132 (132.0 method) return sender=:1.2 -> dest=:1.22 reply_serial=2 array [ struct { object path "/net/connman/technology/gadget" array [ dict entry( string "Name" variant string "Gadget" ) dict entry( string "Type" variant string "gadget" ) dict entry( string "Powered" variant boolean true ) dict entry( string "Connected" variant boolean false ) dict entry( string "Tethering" variant boolean true ) ] } struct { object path "/net/connman/technology/ethernet" array [ dict entry( string "Name" variant string "Wired" ) dict entry( string "Type" variant string "ethernet" ) dict entry( string "Powered" variant boolean true ) dict entry( string "Connected" variant boolean false ) dict entry( string "Tethering" variant boolean false ) ] } ] USB gadget side: usb0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx inet6 addr: fe80::ff:fe00:1011/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2 errors:0 dropped:0 overruns:0 frame:0 TX packets:11 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:104 (104.0 B) TX bytes:902 (902.0 B) method return sender=:1.2 -> dest=:1.169 reply_serial=2 array [ struct { object path "/net/connman/service/gadget_xxxxxxxxxxxx_usb" array [ dict entry( string "Type" variant string "gadget" ) dict entry( string "Security" variant array [ ] ) dict entry( string "State" variant string "idle" ) dict entry( string "Favorite" variant boolean false ) dict entry( string "Immutable" variant boolean false ) dict entry( string "AutoConnect" variant boolean false ) dict entry( string "Name" variant string "Wired" ) dict entry( string "Ethernet" variant array [ dict entry( string "Method" variant string "auto" ) dict entry( string "Interface" variant string "usb0" ) dict entry( string "Address" variant string "xx:xx:xx:xx:xx:xx" ) dict entry( string "MTU" variant uint16 1500 ) ] ) dict entry( string "IPv4" variant array [ ] ) dict entry( string "IPv4.Configuration" variant array [ dict entry( string "Method" variant string "dhcp" ) ] ) dict entry( string "IPv6" variant array [ ] ) dict entry( string "IPv6.Configuration" variant array [ dict entry( string "Method" variant string "auto" ) dict entry( string "Privacy" variant string "disabled" ) ] ) dict entry( string "Nameservers" variant array [ ] ) dict entry( string "Nameservers.Configuration" variant array [ ] ) dict entry( string "Timeservers" variant array [ ] ) dict entry( string "Timeservers.Configuration" variant array [ ] ) dict entry( string "Domains" variant array [ ] ) dict entry( string "Domains.Configuration" variant array [ ] ) dict entry( string "Proxy" variant array [ ] ) dict entry( string "Proxy.Configuration" variant array [ ] ) dict entry( string "Provider" variant array [ ] ) ] } ] _______________________________________________ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman