You are on page 1of 17

Update of /home/cvs/.

cvsroot/WLAN/protocols/aut/src
In directory azcvsrep:/tmp/cvs-serv1130/src
Modified Files:
Tag: B-FMC-0510-01
Makefile aut_aip_msg.C aut_cli.C aut_ike.C aut_ike_msg.C aut_main.C aut_
oam_msg.C aut_ppp_msg.C aut_route.C aut_sess_util.C aut_sgsn_sm.C aut_sm_msg.C L
og Message:
IssueID: None
FeatureID: DNS and APN conversion
Description: Extraction of APN NI and added state machine to handle DNS Query

Index: aut_cli.C
===================================================================
RCS file: /home/cvs/.cvsroot/WLAN/protocols/aut/src/aut_cli.C,v
retrieving revision 1.4.12.2
retrieving revision 1.4.12.3
diff -C 2 -d -r1.4.12.2 -r1.4.12.3
*** aut_cli.C 27 Apr 2009 05:15:14 -0000 1.4.12.2
--- aut_cli.C 3 Jun 2009 06:45:22 -0000 1.4.12.3
***************
*** 350,353 ****
--- 350,410 ----
}
+ static void aut_cli_recv_show_grx_mode(UdpAddress src_addr) {
+ UINT32 msg_len = 0;
+ BYTE dump_buf[CLI_MAX_BUF_SIZE];
+ BYTE *p_cur = &dump_buf[0];
+ TRACE(AUT_TRACE_GROUP);
+
+ if (g_aut.config.nonGRXRealm.length)
+ {
+ msg_len += cli_print_buf(&p_cur,
+ "Non GRX mode enabled.\nRealm = %s\n",
+ g_aut.config.nonGRXRealm.value);
+ }
+ else
+ {
+ msg_len += cli_print_buf(&p_cur, "GRX mode enabled.\n");
+ }
+
+ /* send the response message to CLI */
+ if (g_aut.cli_sock->Send(src_addr, (void *)dump_buf, msg_len)) {
+ LOG(LOG_DEBUG, "Sent show GRX-mode to CLI, len %d", msg_len);
+ } else {
+ LOG(LOG_ERR, "Failed to send GRX-mode to CLI");
+ }
+ }
+
+ static void aut_cli_recv_set_grx_mode(UdpAddress src_addr, cli_msg_t*
p_msg)
+ {
+ UINT32 msg_len = 0;
+ BYTE dump_buf[CLI_MAX_BUF_SIZE];
+ BYTE *p_cur = &dump_buf[0];
+ TRACE(AUT_TRACE_GROUP);
+
+ if (p_msg->u.value)
+ {
+ g_aut.config.nonGRXRealm.length = strlen(p_msg->u.apn);
+ strcpy((char*)g_aut.config.nonGRXRealm.value, p_msg->u.apn);
+ LOG(LOG_DEBUG, "Set to non-GRX-mode - Realm = %s",
+ g_aut.config.nonGRXRealm.value);
+ }
+ else
+ {
+ g_aut.config.nonGRXRealm.length = 0;
+ LOG(LOG_DEBUG, "Set to GRX-mode from CLI");
+ }
+
+ msg_len += cli_print_buf(&p_cur, "Successfully set GRX mode.\n");
+
+ /* send the response message to CLI */
+ if (g_aut.cli_sock->Send(src_addr, (void *)dump_buf, msg_len)) {
+ LOG(LOG_DEBUG, "Sent set grx-mode response to CLI, len %d",
msg_len);
+ } else {
+ LOG(LOG_ERR, "Failed to send set grx-mode response to CLI");
+ }
+
+ }
+
static VOID aut_cli_recv_set_qos_conf (UdpAddress src_addr,
void *msg,
***************
*** 1018,1022 ****
break;
}
! // Ramya: For RAI
case CLI_MSG_SHOW_PLMNID:
{
--- 1075,1079 ----
break;
}
! /* For RAI */
case CLI_MSG_SHOW_PLMNID:
{
***************
*** 1031,1034 ****
--- 1088,1110 ----
break;
}
+ /* GRX mode configuration */
+ case CLI_MSG_SHOW_GRX_MODE:
+ {
+ LOG(LOG_DEBUG, "Received Show GRX-mode command");
+ aut_cli_recv_show_grx_mode(src_addr);
+ break;
+ }
+ case CLI_MSG_SET_GRX_MODE:
+ {
+ LOG(LOG_DEBUG, "Received Show GRX-mode command");
+ aut_cli_recv_set_grx_mode(src_addr, p_msg);
+ break;
+ }
+ case CLI_MSG_SET_NON_GRX_MODE:
+ {
+ LOG(LOG_DEBUG, "Received Show GRX-mode command");
+ aut_cli_recv_set_grx_mode(src_addr, p_msg);
+ break;
+ }
default:
LOG(LOG_ERR, "Received invalid message %d from CLI", p_msg->type);
Index: aut_sm_msg.C
===================================================================
RCS file: /home/cvs/.cvsroot/WLAN/protocols/aut/src/aut_sm_msg.C,v
retrieving revision 1.10.12.5
retrieving revision 1.10.12.6
diff -C 2 -d -r1.10.12.5 -r1.10.12.6
*** aut_sm_msg.C 30 May 2009 10:51:00 -0000 1.10.12.5
--- aut_sm_msg.C 3 Jun 2009 06:45:23 -0000 1.10.12.6
***************
*** 22,25 ****
--- 22,31 ----
*
* LOG: $Log$
+ * LOG: Revision 1.10.12.6 2009/06/03 06:45:23 brajappa
+ * LOG:
+ * LOG: IssueID: None
+ * LOG: FeatureID: DNS and APN conversion
+ * LOG: Description: Extraction of APN NI and added state machine to
handle DNS Query
+ * LOG:
* LOG: Revision 1.10.12.5 2009/05/30 10:51:00 brajappa
* LOG:
***************
*** 146,150 ****
req_msg.msg.create_req.msisdn = p_sess->msisdn;
req_msg.msg.create_req.pdp_addr = p_sess->ip_addr;
! req_msg.msg.create_req.apn = p_sess->apn;
req_msg.msg.create_req.sel_mode = (UBYTE)p_sess->sel_mode;
req_msg.msg.create_req.qos_prof = p_sess->qos;
--- 152,156 ----
req_msg.msg.create_req.msisdn = p_sess->msisdn;
req_msg.msg.create_req.pdp_addr = p_sess->ip_addr;
! req_msg.msg.create_req.apn = p_sess->apnNI;
req_msg.msg.create_req.sel_mode = (UBYTE)p_sess->sel_mode;
req_msg.msg.create_req.qos_prof = p_sess->qos;
***************
*** 467,471 ****
p_sess->msisdn = p_msg->msg.create_req.msisdn;
p_sess->ip_addr = p_msg->msg.create_req.pdp_addr;
! p_sess->apn = p_msg->msg.create_req.apn;
p_sess->pco = p_msg->msg.create_req.pco;
p_sess->sel_mode = (SEL_MODE)p_msg->msg.create_req.sel_mode;
--- 473,477 ----
p_sess->msisdn = p_msg->msg.create_req.msisdn;
p_sess->ip_addr = p_msg->msg.create_req.pdp_addr;
! p_sess->apnNI = p_msg->msg.create_req.apn;
p_sess->pco = p_msg->msg.create_req.pco;
p_sess->sel_mode = (SEL_MODE)p_msg->msg.create_req.sel_mode;
Index: aut_sgsn_sm.C
===================================================================
RCS file: /home/cvs/.cvsroot/WLAN/protocols/aut/src/aut_sgsn_sm.C,v
retrieving revision 1.14.12.1
retrieving revision 1.14.12.2
diff -C 2 -d -r1.14.12.1 -r1.14.12.2
*** aut_sgsn_sm.C 29 May 2009 14:06:58 -0000 1.14.12.1
--- aut_sgsn_sm.C 3 Jun 2009 06:45:23 -0000 1.14.12.2
***************
*** 19,22 ****
--- 19,24 ----
#include "aut.h"
#include "aut_sess_util.h"
+ #include "aut_route.h"
+ #include "resolv_types.h"
extern "C" {
#include "timer.h"
***************
*** 33,36 ****
--- 35,43 ----
aut_sgsn_sm_dns_lookup_req},
+ {STATE_INIT,
+ EVENT_APN_RESOLVE_REQ,
+ STATE_DNS_LOOKUP,
+ aut_sgsn_sm_apn_resolve_req},
+
{STATE_DNS_LOOKUP,
EVENT_OK,
***************
*** 108,111 ****
--- 115,165 ----
}
+ /* Resolve the APN to get GGSN IP address */ void
+ aut_sgsn_sm_apn_resolve_req(void *arg) {
+ INT32 ret;
+ aut_sess_t *p_sgsn_sess = (aut_sess_t *)arg;
+ BYTE tmpApnNI[MAX_APN_NI_LENGTH];
+ RESOLV_AUTMsg resolvReq;
+ TRACE(AUT_TRACE_GROUP);
+
+ resolvReq.msgType = RESOLV_LOOKUP_REQ_MSG;
+ resolvReq.sessId = p_sgsn_sess->id;
+ resolvReq.ipAddress = 0;
+
+ /* NI stored is in APN format. Convert it to string for easier
+ concatination */
+ convert_apn_to_str(&(p_sgsn_sess->apnNI), tmpApnNI);
+ if (g_aut.config.nonGRXRealm.length == 0)
+ {
+ /* MWSG is in GRX network. From the Home MNC and MCC in SGSN
session,
+ construct the GPRS OI */
+ snprintf(resolvReq.domainName, MAX_GPRS_APN_LENGTH,
+ "%s.mnc%03x.mcc%03x.gprs", tmpApnNI,
+ p_sgsn_sess->homePlmnID.mnc,
+ p_sgsn_sess->homePlmnID.mcc);
+ }
+ else
+ {
+ /* MWSG is in non-GRX network. Take the realm configured for it */
+ snprintf(resolvReq.domainName, MAX_GPRS_APN_LENGTH, "%s.%s",
+ tmpApnNI, g_aut.config.nonGRXRealm.value);
+ }
+
+ LOG(LOG_INFO, "Requesting APN <%s> for name resolution",
+ resolvReq.domainName);
+
+ ret = g_aut.resolv_sock->Send(*(g_aut.resolv_addr),
+ (void*)&resolvReq, sizeof(resolvReq));
+ if (ret < 0)
+ {
+ UBYTE event = EVENT_FAIL;
+ LOG(LOG_ERR, "Failed to resolve APN, id(%d)", p_sgsn_sess->id);
+ aut_sess_sm_action(p_sgsn_sess->state, event, p_sgsn_sess);
+ }
+
+ return;
+ }
+
/* send a create request to SGSN stack */
void aut_sgsn_sm_pdp_create_req(void *arg)
***************
*** 400,403 ****
--- 454,458 ----
p_sgsn_sess->qos = p_sess->qos;
p_sgsn_sess->ggsn_addr = p_sess->ggsn_addr;
+ p_sgsn_sess->homePlmnID = p_sess->homePlmnID;
p_sgsn_sess->aznVisitedPlmnID = p_sess->aznVisitedPlmnID;
if (p_sess->sess_type == SESS_TYPE_GGSN) {
***************
*** 408,420 ****
/* Use Proxy APN if a shadow entry is found */
if (p_sess->proxy_apn.length) {
! p_sgsn_sess->apn = p_sess->proxy_apn;
} else {
! p_sgsn_sess->apn = p_sess->apn;
}
/* resolve the mapping APN if required */
/* this will be performed if GGSN IP address is pointing to local */
! if (p_sgsn_sess->ggsn_addr == g_aut.ggsn_addr) {
event = EVENT_DNS_LOOKUP_REQ;
! } else {
ip_address.s_addr = p_sgsn_sess->ggsn_addr;
LOG(LOG_INFO, "GGSN address is %s", inet_ntoa(ip_address));
--- 463,482 ----
/* Use Proxy APN if a shadow entry is found */
if (p_sess->proxy_apn.length) {
! p_sgsn_sess->apnNI = p_sess->proxy_apn;
} else {
! p_sgsn_sess->apnNI = p_sess->apnNI;
}
/* resolve the mapping APN if required */
/* this will be performed if GGSN IP address is pointing to local */
! if (p_sgsn_sess->ggsn_addr == 0)
! {
! /* GGSN IP not resolved at AAA. Need to be resolved */
! LOG(LOG_INFO, "Preaparing for APN Lookup");
! event = EVENT_APN_RESOLVE_REQ;
! }
! else if (p_sgsn_sess->ggsn_addr == g_aut.ggsn_addr) {
event = EVENT_DNS_LOOKUP_REQ;
! }
! else {
ip_address.s_addr = p_sgsn_sess->ggsn_addr;
LOG(LOG_INFO, "GGSN address is %s", inet_ntoa(ip_address));
***************
*** 470,471 ****
--- 532,588 ----
return;
}
+
+ void aut_resolv_msg_handler(UdpAddress& pktSrcAddr,
+ UBYTE *msgBuf,
+ UINT32 msgLen) {
+ RESOLV_AUTMsg* resolvResp = (RESOLV_AUTMsg*)msgBuf;
+ aut_sess_t* p_sgsn_sess = NULL;
+ UBYTE event;
+
+ TRACE(AUT_TRACE_GROUP);
+
+ if (resolvResp->msgType != RESOLV_LOOKUP_RESP_MSG)
+ {
+ LOG(LOG_ERR, "Invalid message from Resolver %d",
+ resolvResp->msgType);
+ return;
+ }
+
+ p_sgsn_sess = aut_sess_find_by_id(resolvResp->sessId);
+ if (p_sgsn_sess == NULL)
+ {
+ LOG(LOG_ERR, "Failed to find SGSN session %d for DNS answer",
+ p_sgsn_sess->id);
+ return;
+ }
+
+ if (p_sgsn_sess->state != STATE_DNS_LOOKUP)
+ {
+ LOG(LOG_ERR, "DNS answer received in invalid state <%d> "
+ "for SGSN session <%d>", p_sgsn_sess->state,
p_sgsn_sess->id);
+ return;
+ }
+
+ if (resolvResp->ipAddress != 0)
+ {
+ struct in_addr addr;
+ addr.s_addr = resolvResp->ipAddress;
+ LOG(LOG_INFO, "Resolved GGSN IP Address <%s> SGSN session <%d>",
+ inet_ntoa(addr), p_sgsn_sess->id);
+
+ /* Proceed to setup PDP context */
+ event = EVENT_OK;
+ p_sgsn_sess->ggsn_addr = resolvResp->ipAddress;
+ }
+ else
+ {
+ event = EVENT_FAIL;
+ p_sgsn_sess->disc_cause = apn_resolution_failure;
+ LOG(LOG_ERR, "DNS Resolution failed for APN = <%s> NAI = <%s>"
+ "SGSN session <%d> ", resolvResp->domainName,
+ p_sgsn_sess->nai.value, p_sgsn_sess->id);
+ }
+
+ aut_sess_sm_action(p_sgsn_sess->state, event, p_sgsn_sess); }
Index: Makefile
===================================================================
RCS file: /home/cvs/.cvsroot/WLAN/protocols/aut/src/Makefile,v
retrieving revision 1.6.12.1
retrieving revision 1.6.12.2
diff -C 2 -d -r1.6.12.1 -r1.6.12.2
*** Makefile 6 Apr 2009 12:18:31 -0000 1.6.12.1
--- Makefile 3 Jun 2009 06:45:21 -0000 1.6.12.2
***************
*** 49,53 ****
aut_main.C
! USER_INC = -I../inc -I$(ROOTDIR)/aip/inc -I$(LICINC)
USERFLAGS = -DLINUX -DDEBUG -D_LC_ARCH_
CFLAGS += $(COMMON_INC) $(USER_INC) $(DEBUG) \
--- 49,53 ----
aut_main.C
! USER_INC = -I../inc -I$(ROOTDIR)/aip/inc -I$(LICINC) -I$(ROOTDIR)/resolv/inc
USERFLAGS = -DLINUX -DDEBUG -D_LC_ARCH_
CFLAGS += $(COMMON_INC) $(USER_INC) $(DEBUG) \
Index: aut_route.C
===================================================================
RCS file: /home/cvs/.cvsroot/WLAN/protocols/aut/src/aut_route.C,v
retrieving revision 1.6
retrieving revision 1.6.12.1
diff -C 2 -d -r1.6 -r1.6.12.1
*** aut_route.C 23 Aug 2007 22:48:11 -0000 1.6
--- aut_route.C 3 Jun 2009 06:45:22 -0000 1.6.12.1
***************
*** 115,119 ****
/* convert to string */
! convert_apn_to_str(&(p_sess->apn), tmpApnBuf);
/* check for any exception routing */
apn_route = aut_check_apn_route(tmpApnBuf);
--- 115,119 ----
/* convert to string */
! convert_apn_to_str(&(p_sess->apnNI), tmpApnBuf);
/* check for any exception routing */
apn_route = aut_check_apn_route(tmpApnBuf);
***************
*** 142,146 ****
/* convert to string */
! convert_apn_to_str(&(p_sess->apn), tmpApnBuf);
tmpApnLen = strlen(tmpApnBuf);
--- 142,146 ----
/* convert to string */
! convert_apn_to_str(&(p_sess->apnNI), tmpApnBuf);
tmpApnLen = strlen(tmpApnBuf);
***************
*** 179,183 ****
convert_apn_to_str(&(p_sess->proxy_apn), tmpApnBuf);
} else {
! convert_apn_to_str(&(p_sess->apn), tmpApnBuf + 4);
/* prepend cmm to the APN */
memcpy(tmpApnBuf, cmm_str, 4);
--- 179,183 ----
convert_apn_to_str(&(p_sess->proxy_apn), tmpApnBuf);
} else {
! convert_apn_to_str(&(p_sess->apnNI), tmpApnBuf + 4);
/* prepend cmm to the APN */
memcpy(tmpApnBuf, cmm_str, 4);
Index: aut_main.C
===================================================================
RCS file: /home/cvs/.cvsroot/WLAN/protocols/aut/src/aut_main.C,v
retrieving revision 1.12.2.1.8.11
retrieving revision 1.12.2.1.8.12
diff -C 2 -d -r1.12.2.1.8.11 -r1.12.2.1.8.12
*** aut_main.C 3 Jun 2009 06:06:32 -0000 1.12.2.1.8.11
--- aut_main.C 3 Jun 2009 06:45:22 -0000 1.12.2.1.8.12
***************
*** 22,25 ****
--- 22,31 ----
*
* LOG: $Log$
+ * LOG: Revision 1.12.2.1.8.12 2009/06/03 06:45:22 brajappa
+ * LOG:
+ * LOG: IssueID: None
+ * LOG: FeatureID: DNS and APN conversion
+ * LOG: Description: Extraction of APN NI and added state machine to
handle DNS Query
+ * LOG:
* LOG: Revision 1.12.2.1.8.11 2009/06/03 06:06:32 sbhaskaran
* LOG:
***************
*** 280,284 ****
void aut_process()
{
! INT32 sm_fd, ike_fd, atc_fd, aip_fd, oam_fd, dhcp_fd, max_fd;
INT32 cli_fd, fa_fd;
#ifdef _LC_ARCH_
--- 286,290 ----
void aut_process()
{
! INT32 sm_fd, ike_fd, atc_fd, aip_fd, oam_fd, dhcp_fd, resolv_fd,
max_fd;
INT32 cli_fd, fa_fd;
#ifdef _LC_ARCH_
***************
*** 307,310 ****
--- 313,317 ----
cli_fd = g_aut.cli_sock->GetSockFd();
fa_fd = g_aut.fa_sock->GetSockFd();
+ resolv_fd = g_aut.resolv_sock->GetSockFd(); /* to interact with
Resolver */
#ifdef _LC_ARCH_
tun_fd = g_aut.tun_sock->GetSockFd();
***************
*** 320,323 ****
--- 327,331 ----
max_fd = (max_fd > g_aut.ipc_fd) ? max_fd : g_aut.ipc_fd;
max_fd = (max_fd > g_aut.nl_fd) ? max_fd : g_aut.nl_fd;
+ max_fd = (max_fd > resolv_fd) ? max_fd : resolv_fd;
#ifdef _LC_ARCH_
max_fd = (max_fd > tun_fd) ? max_fd : tun_fd;
***************
*** 354,357 ****
--- 362,366 ----
FD_SET(g_aut.ipc_fd, &fdset);
FD_SET(g_aut.nl_fd, &fdset);
+ FD_SET(resolv_fd, &fdset);
#ifdef _LC_ARCH_
FD_SET(tun_fd, &fdset);
***************
*** 541,544 ****
--- 550,562 ----
}
}
+
+ if (FD_ISSET(resolv_fd, &fdset)) {
+ msg_len = AUT_MAX_BUFFER_SIZE;
+ if (g_aut.resolv_sock->Recv(pktSrcAddr, (void *)msg_buf,
+ msg_len))
{
+ aut_resolv_msg_handler(pktSrcAddr, (UBYTE *)msg_buf, msg_len);
+ } else {
+ LOG(LOG_CRIT,"Receive Error from Resolver socket!!");
+ }
+ }
#ifdef _LC_ARCH_
/*---------------------------------------
Index: aut_oam_msg.C
===================================================================
RCS file: /home/cvs/.cvsroot/WLAN/protocols/aut/src/aut_oam_msg.C,v
retrieving revision 1.28.2.3.6.7
retrieving revision 1.28.2.3.6.8
diff -C 2 -d -r1.28.2.3.6.7 -r1.28.2.3.6.8
*** aut_oam_msg.C 1 Jun 2009 12:34:20 -0000 1.28.2.3.6.7
--- aut_oam_msg.C 3 Jun 2009 06:45:22 -0000 1.28.2.3.6.8
***************
*** 22,25 ****
--- 22,31 ----
*
* LOG: $Log$
+ * LOG: Revision 1.28.2.3.6.8 2009/06/03 06:45:22 brajappa
+ * LOG:
+ * LOG: IssueID: None
+ * LOG: FeatureID: DNS and APN conversion
+ * LOG: Description: Extraction of APN NI and added state machine to
handle DNS Query
+ * LOG:
* LOG: Revision 1.28.2.3.6.7 2009/06/01 12:34:20 sbhaskaran
* LOG:
***************
*** 413,417 ****
if (filter->flag & SUBS_MGMT_QUERY_FILTER_FLAG_APN)
{
! convert_apn_to_str(&(p_sess->apn), apn_str);
if (!( !strcmp(apn_str, filter->apn)))
{
--- 419,423 ----
if (filter->flag & SUBS_MGMT_QUERY_FILTER_FLAG_APN)
{
! convert_apn_to_str(&(p_sess->apnNI), apn_str);
if (!( !strcmp(apn_str, filter->apn)))
{
***************
*** 483,487 ****
resp->username[p_sess->nai.length] = '\0';
resp->remoteIpAddress = p_sess->ip_addr;
! convert_apn_to_str(&p_sess->apn, resp->apn);
resp->accessType = p_sess->sess_type;
p_link_sess = aut_get_link_sess(p_sess);
--- 489,493 ----
resp->username[p_sess->nai.length] = '\0';
resp->remoteIpAddress = p_sess->ip_addr;
! convert_apn_to_str(&p_sess->apnNI, resp->apn);
resp->accessType = p_sess->sess_type;
p_link_sess = aut_get_link_sess(p_sess);
Index: aut_ike.C
===================================================================
RCS file: /home/cvs/.cvsroot/WLAN/protocols/aut/src/aut_ike.C,v
retrieving revision 1.16.10.4
retrieving revision 1.16.10.5
diff -C 2 -d -r1.16.10.4 -r1.16.10.5
*** aut_ike.C 19 Apr 2009 08:32:45 -0000 1.16.10.4
--- aut_ike.C 3 Jun 2009 06:45:22 -0000 1.16.10.5
***************
*** 22,25 ****
--- 22,31 ----
*
* LOG: $Log$
+ * LOG: Revision 1.16.10.5 2009/06/03 06:45:22 brajappa
+ * LOG:
+ * LOG: IssueID: None
+ * LOG: FeatureID: DNS and APN conversion
+ * LOG: Description: Extraction of APN NI and added state machine to
handle DNS Query
+ * LOG:
* LOG: Revision 1.16.10.4 2009/04/19 08:32:45 sbhaskaran
* LOG:
***************
*** 505,508 ****
--- 511,515 ----
break;
case GGSN_ROUTE:
+ #if 0
/* check if PDG policy is set */
if (!(p_sess->ggsn_addr)) {
***************
*** 516,519 ****
--- 523,530 ----
p_sess->sess_flags &= !(DIRECT_ROUTE_FLAG);
}
+ #endif
+ // p_sess->ggsn_addr = 0; // Just for testing
+ /* clear any PDG flags */
+ p_sess->sess_flags &= !(DIRECT_ROUTE_FLAG);
break;
default:
***************
*** 535,539 ****
#endif // _REDHAT_
! if (p_sess->apn.length) {
/* map the APN and get the shadow APN */
aut_sess_check_shadow_apn(p_sess);
--- 546,550 ----
#endif // _REDHAT_
! if (p_sess->apnNI.length) {
/* map the APN and get the shadow APN */
aut_sess_check_shadow_apn(p_sess);
Index: aut_ike_msg.C
===================================================================
RCS file: /home/cvs/.cvsroot/WLAN/protocols/aut/src/aut_ike_msg.C,v
retrieving revision 1.14.2.2.8.6
retrieving revision 1.14.2.2.8.7
diff -C 2 -d -r1.14.2.2.8.6 -r1.14.2.2.8.7
*** aut_ike_msg.C 1 Jun 2009 12:33:00 -0000 1.14.2.2.8.6
--- aut_ike_msg.C 3 Jun 2009 06:45:22 -0000 1.14.2.2.8.7
***************
*** 22,25 ****
--- 22,31 ----
*
* LOG: $Log$
+ * LOG: Revision 1.14.2.2.8.7 2009/06/03 06:45:22 brajappa
+ * LOG:
+ * LOG: IssueID: None
+ * LOG: FeatureID: DNS and APN conversion
+ * LOG: Description: Extraction of APN NI and added state machine to
handle DNS Query
+ * LOG:
* LOG: Revision 1.14.2.2.8.6 2009/06/01 12:33:00 sbhaskaran
* LOG:
***************
*** 328,336 ****
p_sess->nai = p_msg->msg.create_req.client_id;
}
! if ((p_sess->apn.length == 0) && (p_msg->msg.create_req.apn.length >
0))
{
! LOG(LOG_DEBUG, "apn length : %u",
p_msg->msg.create_req.apn.length);
LOG(LOG_DEBUG, "apn value : %s", p_msg->msg.create_req.apn.value);
! convert_str_to_apn(&p_sess->apn, (BYTE
*)p_msg->msg.create_req.apn.value);
}
p_sess->ctxt_id = p_msg->msg.create_req.ike_ctxt_id;
--- 334,343 ----
p_sess->nai = p_msg->msg.create_req.client_id;
}
! if ((p_sess->apnNI.length == 0) && (p_msg->msg.create_req.apn.length >
0))
{
! LOG(LOG_DEBUG, "apn length : %u",
p_msg->msg.create_req.apn.length);
LOG(LOG_DEBUG, "apn value : %s", p_msg->msg.create_req.apn.value);
! convert_str_to_apn(&p_sess->apnNI,
! (BYTE *)p_msg->msg.create_req.apn.value);
}
p_sess->ctxt_id = p_msg->msg.create_req.ike_ctxt_id;
***************
*** 356,425 ****
}
- #if 0
- /*
- * Hardcoding for now.
- * This should be received in Radius Access Accept message.
- */
- strcpy ((char *)p_sess->apn.value, "internet2.voicestream.com");
- p_sess->apn.length = 25;
-
- {
- static unsigned int counter = 0;
- unsigned int temp;
- unsigned int temp2[8];
- unsigned int i;
-
- num = 0x14323191;
- memcpy(p_sess->msisdn.value, &num, 4);
-
- counter++;
- temp = 0xf0684230 + counter;
- temp2[7] = (0xf0000000 & temp) >> 28;
- temp2[6] = (0x0f000000 & temp) >> 24;
- temp2[5] = (0x00f00000 & temp) >> 20;
- temp2[4] = (0x000f0000 & temp) >> 16;
- temp2[3] = (0x0000f000 & temp) >> 12;
- temp2[2] = (0x00000f00 & temp) >> 8;
- temp2[1] = (0x000000f0 & temp) >> 4;
- temp2[0] = (0x0000000f & temp);
-
- for (i = 0; i < 8; i++)
- {
- if (temp2[i] == 0x0a
- || temp2[i] == 0x0b
- || temp2[i] == 0x0c
- || temp2[i] == 0x0d
- || temp2[i] == 0x0e
- || temp2[i] == 0x0f)
- {
- temp2[i] = 0x00;
- temp2[i+1]++;
- }
- }
- temp = 0;
- temp |= ((temp2[7] << 4) | temp2[6]) << 24;
- temp |= ((temp2[5] << 4) | temp2[4]) << 16;
- temp |= ((temp2[3] << 4) | temp2[2]) << 8;
- temp |= ((temp2[1] << 4) | temp2[0]);
-
- memcpy(&(p_sess->msisdn.value[4]), &temp, 4);
- p_sess->msisdn.length = 8;
-
- // set the counter properly.
- counter = temp - 0xf0684230;
- }
- p_sess->gsn_addr = 0xa031e33;
- p_sess->qos.value[0] = 0x25;
- p_sess->qos.value[1] = 0x42;
- p_sess->qos.value[2] = 0x1f;
- p_sess->qos.length = 3;
-
- LOG(LOG_ERR, "### params being sent");
- dump_hex((BYTE *)(p_sess->imsi.value), 8);
- LOG(LOG_ERR, "### MSISDN");
- dump_hex((BYTE *)(p_sess->msisdn.value), 8);
- LOG(LOG_ERR, "### ctxt_id : 0x%x", p_sess->ctxt_id);
- LOG(LOG_ERR, "### ggsn_addr : 0x%x", htonl(p_sess->ggsn_addr));
- #endif
/* trigger the event */
event = EVENT_PDP_CREATE_REQ;
--- 363,366 ----
***************
*** 485,498 ****
&wsg_parsedNai);
/* VPLMN ID */
p_sess->aznVisitedPlmnID.mcc = wsg_parsedNai.visitedMCC;
p_sess->aznVisitedPlmnID.mnc = wsg_parsedNai.visitedMNC;
! LOG(LOG_DEBUG, "aznVPLMN.MCC : %d", p_sess->aznVisitedPlmnID.mcc);
! LOG(LOG_DEBUG, "aznVPLMN.MNC : %d", p_sess->aznVisitedPlmnID.mnc);
p_sess->nsapi = g_aut.nsapi;
p_sess->ctxt_id =
p_msg->msg.authorize_req.ike_ctxt_id;
if (p_msg->msg.authorize_req.apn.length)
! convert_str_to_apn(&p_sess->apn, (BYTE
*)p_msg->msg.authorize_req.apn.value);
p_sess->event_trigger =
p_msg->msg.authorize_req.event_trigger;
--- 426,453 ----
&wsg_parsedNai);
+ /* Store the HPLMN ID*/
+ p_sess->homePlmnID.mcc = wsg_parsedNai.homeMCC;
+ p_sess->homePlmnID.mnc = wsg_parsedNai.homeMNC;
+
/* VPLMN ID */
p_sess->aznVisitedPlmnID.mcc = wsg_parsedNai.visitedMCC;
p_sess->aznVisitedPlmnID.mnc = wsg_parsedNai.visitedMNC;
! LOG(LOG_DEBUG, "aznVPLMN.MCC : %03x", p_sess->aznVisitedPlmnID.mcc);
! LOG(LOG_DEBUG, "aznVPLMN.MNC : %03x", p_sess->aznVisitedPlmnID.mnc);
p_sess->nsapi = g_aut.nsapi;
p_sess->ctxt_id =
p_msg->msg.authorize_req.ike_ctxt_id;
if (p_msg->msg.authorize_req.apn.length)
! {
! BYTE tempNI[MAX_APN_NI_LENGTH];
!
! AUT_WAPNGetNI((BYTE*)p_msg->msg.authorize_req.apn.value,
! tempNI, MAX_APN_NI_LENGTH);
! LOG(LOG_DEBUG, "APN NI : <%s> Home{ MNC = %03x MCC = %03x }",
! tempNI, p_sess->homePlmnID.mnc, p_sess->homePlmnID.mcc);
!
! convert_str_to_apn(&p_sess->apnNI, tempNI);
! }
!
p_sess->event_trigger =
p_msg->msg.authorize_req.event_trigger;

Index: aut_aip_msg.C
===================================================================
RCS file: /home/cvs/.cvsroot/WLAN/protocols/aut/src/aut_aip_msg.C,v
retrieving revision 1.19.2.1.6.11
retrieving revision 1.19.2.1.6.12
diff -C 2 -d -r1.19.2.1.6.11 -r1.19.2.1.6.12
*** aut_aip_msg.C 3 Jun 2009 06:06:13 -0000 1.19.2.1.6.11
--- aut_aip_msg.C 3 Jun 2009 06:45:21 -0000 1.19.2.1.6.12
***************
*** 22,25 ****
--- 22,31 ----
*
* LOG: $Log$
+ * LOG: Revision 1.19.2.1.6.12 2009/06/03 06:45:21 brajappa
+ * LOG:
+ * LOG: IssueID: None
+ * LOG: FeatureID: DNS and APN conversion
+ * LOG: Description: Extraction of APN NI and added state machine to
handle DNS Query
+ * LOG:
* LOG: Revision 1.19.2.1.6.11 2009/06/03 06:06:13 sbhaskaran
* LOG:
***************
*** 220,225 ****
p_req->auth_type = AUTH_TYPE_IMSI;
p_req->u.imsi = p_sess->imsi;
! if (p_sess->apn.length) {
! p_req->apn = p_sess->apn;
}
p_req->nas_port_type = NAS_PORT_TYPE_80211;
--- 226,231 ----
p_req->auth_type = AUTH_TYPE_IMSI;
p_req->u.imsi = p_sess->imsi;
! if (p_sess->apnNI.length) {
! p_req->apn = p_sess->apnNI;
}
p_req->nas_port_type = NAS_PORT_TYPE_80211;
***************
*** 266,271 ****
p_req->username.length = p_sess->imsi.length * 2;
! if (p_sess->apn.length) {
! p_req->apn = p_sess->apn;
} else {
p_req->apn.length = 0;
--- 272,277 ----
p_req->username.length = p_sess->imsi.length * 2;
! if (p_sess->apnNI.length) {
! p_req->apn = p_sess->apnNI;
} else {
p_req->apn.length = 0;
***************
*** 307,313 ****
p_req->aznVisitedPlmnID.mnc = p_sess->aznVisitedPlmnID.mnc;
p_req->client_local_ip = p_sess->tun_addr;
! p_req->apn = p_sess->apn;
// apn value is sent to AIP/rac in string format but we have to give the l
ength.
! convert_apn_to_str(&(p_sess->apn), (BYTE *)p_req->apn.value);
p_req->gw_mode = g_aut.mwsg_mode;
--- 313,319 ----
p_req->aznVisitedPlmnID.mnc = p_sess->aznVisitedPlmnID.mnc;
p_req->client_local_ip = p_sess->tun_addr;
! p_req->apn = p_sess->apnNI;
// apn value is sent to AIP/rac in string format but we have to give the l
ength.
! convert_apn_to_str(&(p_sess->apnNI), (BYTE *)p_req->apn.value);
p_req->gw_mode = g_aut.mwsg_mode;

***************
*** 381,386 ****
}
! if (p_sess->apn.length) {
! p_req->apn = p_sess->apn;
} else {
p_req->apn.length = 0;
--- 387,392 ----
}
! if (p_sess->apnNI.length) {
! p_req->apn = p_sess->apnNI;
} else {
p_req->apn.length = 0;
***************
*** 497,502 ****
}
! if (p_sess->apn.length) {
! p_req->apn = p_sess->apn;
} else {
p_req->apn.length = 0;
--- 503,508 ----
}
! if (p_sess->apnNI.length) {
! p_req->apn = p_sess->apnNI;
} else {
p_req->apn.length = 0;
***************
*** 793,798 ****
if (p_rsp->apn.length)
{
! p_sess->apn = p_rsp->apn;
! convert_apn_to_str(&p_sess->apn, (BYTE*)apnStr.value);
apnStr.length = p_rsp->apn.length;
LOG(LOG_DEBUG, "APN received from RAC = %s", p_rsp->apn.value);
--- 799,804 ----
if (p_rsp->apn.length)
{
! p_sess->apnNI = p_rsp->apn;
! convert_apn_to_str(&p_sess->apnNI, (BYTE*)apnStr.value);
apnStr.length = p_rsp->apn.length;
LOG(LOG_DEBUG, "APN received from RAC = %s", p_rsp->apn.value);
Index: aut_ppp_msg.C
===================================================================
RCS file: /home/cvs/.cvsroot/WLAN/protocols/aut/src/aut_ppp_msg.C,v
retrieving revision 1.6
retrieving revision 1.6.12.1
diff -C 2 -d -r1.6 -r1.6.12.1
*** aut_ppp_msg.C 13 Jun 2007 02:04:48 -0000 1.6
--- aut_ppp_msg.C 3 Jun 2009 06:45:22 -0000 1.6.12.1
***************
*** 242,246 ****
p_sess->imsi = p_req->msg.auth_req.imsi;
p_sess->nsapi = g_aut.nsapi;
! p_sess->apn = p_req->msg.auth_req.apn;
p_sess->ppp_pid = p_req->msg.auth_req.ppp_pid;
memcpy(p_sess->p_auth_val->nonce, p_req->msg.auth_req.nonce, IV_SIZE);
--- 242,246 ----
p_sess->imsi = p_req->msg.auth_req.imsi;
p_sess->nsapi = g_aut.nsapi;
! p_sess->apnNI = p_req->msg.auth_req.apn;
p_sess->ppp_pid = p_req->msg.auth_req.ppp_pid;
memcpy(p_sess->p_auth_val->nonce, p_req->msg.auth_req.nonce, IV_SIZE);
Index: aut_sess_util.C
===================================================================
RCS file: /home/cvs/.cvsroot/WLAN/protocols/aut/src/aut_sess_util.C,v
retrieving revision 1.26.2.2.6.16
retrieving revision 1.26.2.2.6.17
diff -C 2 -d -r1.26.2.2.6.16 -r1.26.2.2.6.17
*** aut_sess_util.C 3 Jun 2009 06:07:28 -0000 1.26.2.2.6.16
--- aut_sess_util.C 3 Jun 2009 06:45:23 -0000 1.26.2.2.6.17
***************
*** 22,25 ****
--- 22,31 ----
*
* LOG: $Log$
+ * LOG: Revision 1.26.2.2.6.17 2009/06/03 06:45:23 brajappa
+ * LOG:
+ * LOG: IssueID: None
+ * LOG: FeatureID: DNS and APN conversion
+ * LOG: Description: Extraction of APN NI and added state machine to
handle DNS Query
+ * LOG:
* LOG: Revision 1.26.2.2.6.16 2009/06/03 06:07:28 sbhaskaran
* LOG:
***************
*** 1354,1357 ****
--- 1360,1367 ----
g_aut.fa_addr = new UdpAddress(0x7f000001, FA_AUT_PORT);
+ /* For DNS resolution */
+ g_aut.resolv_sock = new UdpSocket(AUT_RESOLV_PORT);
+ g_aut.resolv_addr = new UdpAddress(0x7f000001, RESOLV_AUT_PORT);
+
/* net link socket init */
g_aut.nl_fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_TAPBASE+10);
***************
*** 2321,2325 ****
aut_util_conv_imsi_to_str(imsi_str, (BYTE *)(p_sess->imsi.value));
LOG(LOG_INFO, "imsi : %s", imsi_str);
! convert_apn_to_str(&(p_sess->apn), apn_str);
LOG(LOG_INFO, "apn : %s", apn_str);
convert_apn_to_str(&(p_sess->proxy_apn), apn_str);
--- 2331,2335 ----
aut_util_conv_imsi_to_str(imsi_str, (BYTE *)(p_sess->imsi.value));
LOG(LOG_INFO, "imsi : %s", imsi_str);
! convert_apn_to_str(&(p_sess->apnNI), apn_str);
LOG(LOG_INFO, "apn : %s", apn_str);
convert_apn_to_str(&(p_sess->proxy_apn), apn_str);
***************
*** 3051,3054 ****
--- 3061,3065 ----
}
+
LOG(LOG_DEBUG, "Number of egress queues configured in AUT = %d",
g_aut.config.egressQueues.numQueues);
***************
*** 4004,4005 ****
--- 4015,4049 ----
return 0;
}
+
+ /* From the full APN string get the NI portion alone
+ Validates the NI length to bufLen
+ Returns the number of characters parsed.
+ will be equal to buflen on overflow */
+ INT32 AUT_WAPNGetNI(BYTE* apnStr, BYTE* apnNIStr, INT32 bufLen) {
+ INT32 niLen = 0;
+ for( ; *apnStr && niLen < bufLen; apnStr++)
+ {
+ if (strncmp(apnStr, ".w-apn.", 6) == 0)
+ {
+ /* WAPN contains the OI. We don't need OI */
+ break;
+ }
+ else
+ {
+ apnNIStr[niLen++] = *apnStr;
+ }
+ }
+ if (niLen == bufLen)
+ {
+ /* Overflow */
+ apnNIStr[niLen - 1] = '\0';
+ }
+ else
+ {
+ apnNIStr[niLen] = '\0';
+ }
+ return niLen;
+ }
+

You might also like