Skip to content

APN verification doesn't allow APNs with single character before period #263

@githubmt2015

Description

@githubmt2015

This is a simple yet critical bug where an APN such as n.ispsn is marked as invalid. THIS IS THE REASON WHY NO ONE ON SPRINT CAN GET ONTO THEIR APN MANUALLY (without auto configuration via OTA). There are untold many people posting about this core issue on the forums. Here is the incredibly simple solution and it took a while to track down:

The > should be >= in the is_valid_apn method found in: https://github.com/rilmodem/ofono/blob/master/src/common.c

gboolean is_valid_apn(const char *apn)
{
int i;
int last_period = 0;

if (apn[0] == '.')
	return FALSE;

for (i = 0; apn[i] != '\0'; i++) {
	if (g_ascii_isalnum(apn[i]))
		continue;

	if (apn[i] == '-')
		continue;

	if (apn[i] == '.' && (i - last_period) >= 1) {
		last_period = i;
		continue;
	}

	return FALSE;
}

return TRUE;

}

A work around could be to write your own C program duplicating all the functionality of ofono, but I have not yet done this. It may be simpler than editing and recompiling ofono since you would need to set up an entire cross compile environment. (I'm using a Nexus 5 with Ubuntu Touch 16.04 from ubports)

Please HELP!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions