Skip to content

Commit

Permalink
Add noroaming config key and document USB tethering
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Feb 13, 2014
1 parent 0a0768c commit b26cd01
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
19 changes: 19 additions & 0 deletions docs/usb_moded-doc.txt
Expand Up @@ -356,3 +356,22 @@ Usb-moded supports a diagnostic mode. This requires a special command line param
One mode should be configured in /etc/usb-moded/diag and this will be automatically used.
This is a feature to allow for "hidden" or non-standard modes that are only of use for
testing/QA.

USB tethering
-------------

Usb_moded can set up USB tethering. In the sense that it can share the connection of your device to a second one.
Most common use case would be using USB tethering from a phone to a laptop.

When compiled with ofono and connman support you can make the most of this. ofono can be used to detect roaming status.
Connman for getting dns settings and interface from the modem connection.
However it works also without it. It can be configured so that it knows what the interfaces are and get the dns info
from /etc/resolv.conf.

For this are the

#define NETWORK_NAT_INTERFACE_KEY "nat_interface"
#define NO_ROAMING_KEY "noroaming"

Network options. nat_interface documents which interfaces the internet facing modem. noroaming when set to 1
will prohibit enabling the modem interface in case you are roaming (this requires ofono).
4 changes: 4 additions & 0 deletions src/usb_moded-config.c
Expand Up @@ -607,3 +607,7 @@ int check_android_section(void)
return(ret);
}

int is_roaming_not_allowed(void)
{
return(get_conf_int(NETWORK_ENTRY, NO_ROAMING_KEY));
}
3 changes: 3 additions & 0 deletions src/usb_moded-config.h
Expand Up @@ -49,6 +49,7 @@
#define NETWORK_INTERFACE_KEY "interface"
#define NETWORK_GATEWAY_KEY "gateway"
#define NETWORK_NAT_INTERFACE_KEY "nat_interface"
#define NO_ROAMING_KEY "noroaming"
#define ANDROID_ENTRY "android"
#define ANDROID_MANUFACTURER_KEY "iManufacturer"
#define ANDROID_VENDOR_ID_KEY "idVendor"
Expand Down Expand Up @@ -89,5 +90,7 @@ const char * get_android_product_id(void);

int check_android_section(void);

int is_roaming_not_allowed(void);

int conf_file_merge(void);
int set_config_setting(const char *entry, const char *key, const char *value);
6 changes: 5 additions & 1 deletion src/usb_moded-network.c
Expand Up @@ -564,7 +564,11 @@ int usb_network_set_up_dhcpd(struct mode_list_elem *data)
#ifdef OFONO
/* check if we are roaming or not */
if(get_roaming())
goto end;
{
/* get permission to use roaming */
if(is_roaming_not_allowed())
goto end;
}
#endif /* OFONO */
ipforward = malloc(sizeof(struct ipforward_data));
memset(ipforward, 0, sizeof(struct ipforward_data));
Expand Down

0 comments on commit b26cd01

Please sign in to comment.