gtp: sanity check gtp version for PDP context

make sure it's GTP_V0 or GTP_V1.
This commit is contained in:
Pablo Neira Ayuso 2014-02-10 14:54:43 +01:00
parent 2060f60afe
commit a7012e1376
1 changed files with 8 additions and 0 deletions

8
gtp.c
View File

@ -923,6 +923,14 @@ static int ipv4_pdp_add(struct gtp_instance *gti, struct genl_info *info)
bool found = false;
gtp_version = nla_get_u32(info->attrs[GTPA_VERSION]);
switch (gtp_version) {
case GTP_V0:
case GTP_V1:
break;
default:
return -EINVAL;
}
link = nla_get_u32(info->attrs[GTPA_LINK]);
sgsn_addr = nla_get_u32(info->attrs[GTPA_SGSN_ADDRESS]);
ms_addr = nla_get_u32(info->attrs[GTPA_MS_ADDRESS]);