summaryrefslogtreecommitdiff
path: root/libnm-util/nm-setting-gsm.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2011-05-17 10:49:44 -0500
committerDan Williams <dcbw@redhat.com>2011-05-17 10:49:44 -0500
commit7b41be489c5ca702ea3e69add8650a33752eaa58 (patch)
tree74112ed606c2042979373af5eb868cbca7d0e85a /libnm-util/nm-setting-gsm.c
parent5deb993ff6c1af007358038cb797d03456b34557 (diff)
downloadNetworkManager-7b41be489c5ca702ea3e69add8650a33752eaa58.tar.gz
libnm-util: allow _ as a valid character for GSM APNs
The ETSI specs state that valid characters are only ASCII alphanumeric characters, but then state that APNs should generally follow DNS naming rules. Well, that means a lot more characters are allowed, but modems don't like many of them. So let's slowly allow more characters as people find ones that actually are used. The restriction was originally put in place to disallow spaces, because they certainly aren't allowed APN characters and modems and the network puke when they see spaces.
Diffstat (limited to 'libnm-util/nm-setting-gsm.c')
-rw-r--r--libnm-util/nm-setting-gsm.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/libnm-util/nm-setting-gsm.c b/libnm-util/nm-setting-gsm.c
index a1b7a6d3e7..0ece448b96 100644
--- a/libnm-util/nm-setting-gsm.c
+++ b/libnm-util/nm-setting-gsm.c
@@ -241,10 +241,28 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
}
/* APNs roughly follow the same rules as DNS domain names. Allowed
- * characters are a-z, 0-9, . and -. GSM 03.60 Section 14.9.
+ * characters are a-z, 0-9, . and -. GSM 03.03 Section 9.1 states:
+ *
+ * The syntax of the APN shall follow the Name Syntax defined in
+ * RFC 2181 [14] and RFC 1035 [15]. The APN consists of one or
+ * more labels. Each label is coded as one octet length field
+ * followed by that number of octets coded as 8 bit ASCII characters.
+ * Following RFC 1035 [15] the labels should consist only of the
+ * alphabetic characters (A-Z and a-z), digits (0-9) and the
+ * dash (-). The case of alphabetic characters is not significant.
+ *
+ * A dot (.) is commonly used to separate parts of the APN, and
+ * apparently the underscore (_) is used as well. RFC 2181 indicates
+ * that no restrictions of any kind are placed on DNS labels, and thus
+ * it would appear that none are placed on APNs either, but many modems
+ * and networks will fail to accept APNs that include odd characters
+ * like space ( ) and such.
*/
for (i = 0; i < apn_len; i++) {
- if (!isalnum (priv->apn[i]) && (priv->apn[i] != '.') && (priv->apn[i] != '-')) {
+ if ( !isalnum (priv->apn[i])
+ && (priv->apn[i] != '.')
+ && (priv->apn[i] != '_')
+ && (priv->apn[i] != '-')) {
g_set_error (error,
NM_SETTING_GSM_ERROR,
NM_SETTING_GSM_ERROR_INVALID_PROPERTY,