New merge with develop-nr. DL IP traffic reaching up to UE's MAC layer now successfully.
This commit is contained in:
@@ -108,12 +108,9 @@ int NAS_RALconnect(void)
|
||||
void IAL_NAS_ioctl_init(int inst)
|
||||
//---------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
struct nas_msg_statistic_reply *msgrep;
|
||||
int err;
|
||||
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
|
||||
// Get an UDP IPv6 socket ??
|
||||
fd=socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
|
||||
@@ -123,7 +120,6 @@ void IAL_NAS_ioctl_init(int inst)
|
||||
}
|
||||
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
|
||||
gifr.type = NAS_MSG_STATISTIC_REQUEST;
|
||||
memset ((void *)dummy_buffer,0,800);
|
||||
gifr.msg= &(dummy_buffer[0]);
|
||||
@@ -139,8 +135,6 @@ void IAL_NAS_ioctl_init(int inst)
|
||||
printf("tx_bytes = %u, rx_bytes = %u\n", msgrep->tx_bytes, msgrep->rx_bytes);
|
||||
printf("tx_errors = %u, rx_errors = %u\n", msgrep->tx_errors, msgrep->rx_errors);
|
||||
printf("tx_dropped = %u, rx_dropped = %u\n", msgrep->tx_dropped, msgrep->rx_dropped);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -160,11 +154,7 @@ int main(int argc,char **argv)
|
||||
in_addr_t saddr_ipv4 = 0,daddr_ipv4 = 0;
|
||||
struct in6_addr saddr_ipv6,daddr_ipv6;
|
||||
unsigned int mpls_outlabel=0,mpls_inlabel=0;
|
||||
|
||||
char addr_str[46];
|
||||
|
||||
|
||||
|
||||
// scan options
|
||||
rb[0] = '\0';
|
||||
cx[0] = '\0';
|
||||
@@ -174,89 +164,87 @@ int main(int argc,char **argv)
|
||||
|
||||
while ((c = getopt (argc, argv, "adr:i:c:l:m:s:t:x:y:z:")) != -1)
|
||||
switch (c) {
|
||||
case 'a':
|
||||
action = ADD_RB;
|
||||
break;
|
||||
case 'a':
|
||||
action = ADD_RB;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
action = DEL_RB;
|
||||
break;
|
||||
case 'd':
|
||||
action = DEL_RB;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
strcpy(rb,optarg);
|
||||
rbset = 1;
|
||||
break;
|
||||
case 'r':
|
||||
strcpy(rb,optarg);
|
||||
rbset = 1;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
strcpy(inst,optarg);
|
||||
instset = 1;
|
||||
break;
|
||||
case 'i':
|
||||
strcpy(inst,optarg);
|
||||
instset = 1;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
strcpy(cx,optarg);
|
||||
cxset = 1;
|
||||
break;
|
||||
case 'c':
|
||||
strcpy(cx,optarg);
|
||||
cxset = 1;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
strcpy(mpls_outgoinglabel,optarg);
|
||||
mpls_outlabelset=1;
|
||||
break;
|
||||
case 'l':
|
||||
strcpy(mpls_outgoinglabel,optarg);
|
||||
mpls_outlabelset=1;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
strcpy(mpls_incominglabel,optarg);
|
||||
mpls_inlabelset=1;
|
||||
break;
|
||||
case 'm':
|
||||
strcpy(mpls_incominglabel,optarg);
|
||||
mpls_inlabelset=1;
|
||||
break;
|
||||
|
||||
case 's': {
|
||||
struct in_addr a;
|
||||
inet_aton(optarg,&a);
|
||||
saddr_ipv4 = a.s_addr;
|
||||
saddr_ipv4set = 1;
|
||||
break;
|
||||
case 's': {
|
||||
struct in_addr a;
|
||||
inet_aton(optarg,&a);
|
||||
saddr_ipv4 = a.s_addr;
|
||||
saddr_ipv4set = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 't': {
|
||||
struct in_addr a;
|
||||
inet_aton(optarg,&a);
|
||||
daddr_ipv4 = a.s_addr;
|
||||
daddr_ipv4set = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'x':
|
||||
printf("IPv6: %s\n",optarg);
|
||||
inet_pton(AF_INET6,optarg,(void *)&saddr_ipv6);
|
||||
saddr_ipv6set = 1;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
inet_pton(AF_INET6,optarg,(void *)&daddr_ipv6);
|
||||
daddr_ipv6set = 1;
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
dscpset=1;
|
||||
strcpy(dscp,optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isprint (optopt))
|
||||
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else
|
||||
fprintf (stderr,
|
||||
"Unknown option character `\\x%x'.\n",
|
||||
optopt);
|
||||
|
||||
return 1;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
case 't': {
|
||||
struct in_addr a;
|
||||
inet_aton(optarg,&a);
|
||||
daddr_ipv4 = a.s_addr;
|
||||
daddr_ipv4set = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'x':
|
||||
printf("IPv6: %s\n",optarg);
|
||||
inet_pton(AF_INET6,optarg,(void *)&saddr_ipv6);
|
||||
saddr_ipv6set = 1;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
inet_pton(AF_INET6,optarg,(void *)&daddr_ipv6);
|
||||
daddr_ipv6set = 1;
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
dscpset=1;
|
||||
strcpy(dscp,optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isprint (optopt))
|
||||
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else
|
||||
fprintf (stderr,
|
||||
"Unknown option character `\\x%x'.\n",
|
||||
optopt);
|
||||
|
||||
return 1;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
printf ("action = %d, rb = %s,cx = %s\n", action, rb, cx);
|
||||
|
||||
|
||||
if (rbset==0) {
|
||||
printf("ERROR: Specify a RAB id!!\n");
|
||||
exit(-1);
|
||||
@@ -293,31 +281,27 @@ int main(int argc,char **argv)
|
||||
}
|
||||
|
||||
IAL_NAS_ioctl_init(atoi(inst));
|
||||
|
||||
msgreq = (struct nas_msg_rb_establishment_request *)(gifr.msg);
|
||||
msgreq->rab_id = atoi(rb);
|
||||
msgreq->lcr = atoi(cx);
|
||||
msgreq->qos = 0;
|
||||
|
||||
|
||||
if (action == ADD_RB) {
|
||||
gifr.type = NAS_MSG_RB_ESTABLISHMENT_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
if (saddr_ipv4set == 1) {
|
||||
msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 4;
|
||||
|
||||
msgreq_class->classref = 0 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir = NAS_DIRECTION_SEND;
|
||||
msgreq_class->fct = NAS_FCT_QOS_SEND;
|
||||
msgreq_class->saddr.ipv4 = saddr_ipv4;
|
||||
msgreq_class->daddr.ipv4 = daddr_ipv4;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
@@ -326,21 +310,20 @@ int main(int argc,char **argv)
|
||||
else
|
||||
msgreq_class->dscp=atoi(dscp);
|
||||
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = 1+(msgreq_class->lcr<<3);
|
||||
msgreq_class->dir = NAS_DIRECTION_RECEIVE;
|
||||
|
||||
|
||||
msgreq_class->daddr.ipv4 = saddr_ipv4;
|
||||
msgreq_class->saddr.ipv4 = daddr_ipv4;
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
}
|
||||
|
||||
@@ -358,38 +341,32 @@ int main(int argc,char **argv)
|
||||
msgreq_class->classref = 2+(msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_SEND;
|
||||
msgreq_class->fct=NAS_FCT_QOS_SEND;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
memcpy(&msgreq_class->saddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->daddr.ipv6,&daddr_ipv6,16);
|
||||
|
||||
inet_ntop(AF_INET6,(void *)&saddr_ipv6,addr_str,46);
|
||||
printf("IPV6: Source %s\n",addr_str);
|
||||
inet_ntop(AF_INET6,(void *)&daddr_ipv6,addr_str,46);
|
||||
printf("IPV6: Dest %s\n",addr_str);
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = 3+(msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_RECEIVE;
|
||||
memcpy(&msgreq_class->daddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->saddr.ipv6,&daddr_ipv6,16);
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (mpls_inlabelset == 1) {
|
||||
|
||||
msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
@@ -403,50 +380,34 @@ int main(int argc,char **argv)
|
||||
msgreq_class->classref = 4 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_SEND;
|
||||
msgreq_class->fct=NAS_FCT_QOS_SEND;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_outlabel = atoi(mpls_outgoinglabel);
|
||||
|
||||
printf("Setting MPLS outlabel %d with exp %d\n",mpls_outlabel,msgreq_class->dscp);
|
||||
|
||||
printf("Setting MPLS outlabel %u with exp %d\n",mpls_outlabel,msgreq_class->dscp);
|
||||
msgreq_class->daddr.mpls_label = mpls_outlabel;
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = 5 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_RECEIVE;
|
||||
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_inlabel = atoi(mpls_incominglabel);
|
||||
|
||||
printf("Setting MPLS inlabel %d with exp %d\n",mpls_inlabel,msgreq_class->dscp);
|
||||
|
||||
printf("Setting MPLS inlabel %u with exp %d\n",mpls_inlabel,msgreq_class->dscp);
|
||||
msgreq_class->daddr.mpls_label = mpls_inlabel;
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
|
||||
}
|
||||
} else if (action == DEL_RB) {
|
||||
gifr.type = NAS_MSG_RB_RELEASE_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
//#define MPLS
|
||||
|
||||
#ifdef MPLS
|
||||
#include <net/mpls.h>
|
||||
#include <net/mpls.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,12 +46,9 @@
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Add a new classifier rule (send direction)
|
||||
struct classifier_entity *nas_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
|
||||
{
|
||||
struct classifier_entity *nas_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *gc;
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_ADD_SCLASSIFIER: begin for dscp %d, classref %d\n", dscp,classref);
|
||||
#endif
|
||||
@@ -91,8 +88,7 @@ struct classifier_entity *nas_CLASS_add_sclassifier(struct cx_entity *cx, uint8_
|
||||
// Add a new classifier rule (receive direction)
|
||||
struct classifier_entity *nas_CLASS_add_rclassifier(uint8_t dscp,
|
||||
uint16_t classref,
|
||||
struct nas_priv *gpriv)
|
||||
{
|
||||
struct nas_priv *gpriv) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *gc;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
@@ -125,8 +121,7 @@ struct classifier_entity *nas_CLASS_add_rclassifier(uint8_t dscp,
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Add a new classifier rule (forwarding)
|
||||
struct classifier_entity *nas_CLASS_add_fclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
|
||||
{
|
||||
struct classifier_entity *nas_CLASS_add_fclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *gc;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
@@ -166,8 +161,7 @@ struct classifier_entity *nas_CLASS_add_fclassifier(struct cx_entity *cx, uint8_
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nas_CLASS_flush_sclassifier(struct cx_entity *cx)
|
||||
{
|
||||
void nas_CLASS_flush_sclassifier(struct cx_entity *cx) {
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t dscpi;
|
||||
struct classifier_entity *gc;
|
||||
@@ -196,8 +190,7 @@ void nas_CLASS_flush_sclassifier(struct cx_entity *cx)
|
||||
#endif
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void nas_CLASS_flush_fclassifier(struct cx_entity *cx)
|
||||
{
|
||||
void nas_CLASS_flush_fclassifier(struct cx_entity *cx) {
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t dscpi;
|
||||
struct classifier_entity *gc;
|
||||
@@ -227,8 +220,7 @@ void nas_CLASS_flush_fclassifier(struct cx_entity *cx)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nas_CLASS_flush_rclassifier(struct nas_priv *gpriv)
|
||||
{
|
||||
void nas_CLASS_flush_rclassifier(struct nas_priv *gpriv) {
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t dscpi;
|
||||
struct classifier_entity *gc;
|
||||
@@ -251,8 +243,7 @@ void nas_CLASS_flush_rclassifier(struct nas_priv *gpriv)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Delete a classifier rule (send direction)
|
||||
void nas_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
|
||||
{
|
||||
void nas_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *p,*np;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
@@ -295,8 +286,7 @@ void nas_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t clas
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Delete a classifier rule (send direction)
|
||||
void nas_CLASS_del_fclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
|
||||
{
|
||||
void nas_CLASS_del_fclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *p,*np;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
@@ -339,8 +329,7 @@ void nas_CLASS_del_fclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t clas
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Delete a classifier rule (receive direction)
|
||||
void nas_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref,struct nas_priv *gpriv)
|
||||
{
|
||||
void nas_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref,struct nas_priv *gpriv) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *p,*np;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
@@ -379,8 +368,7 @@ struct cx_entity *nas_CLASS_cx6(struct sk_buff *skb,
|
||||
unsigned char dscp,
|
||||
struct nas_priv *gpriv,
|
||||
int inst,
|
||||
unsigned char *cx_searcher)
|
||||
{
|
||||
unsigned char *cx_searcher) {
|
||||
//---------------------------------------------------------------------------
|
||||
unsigned char cxi;
|
||||
unsigned int *addr,*dst=NULL;
|
||||
@@ -388,17 +376,12 @@ struct cx_entity *nas_CLASS_cx6(struct sk_buff *skb,
|
||||
struct classifier_entity *p=NULL;
|
||||
|
||||
if (skb!=NULL) {
|
||||
|
||||
for (cxi=*cx_searcher; cxi<NAS_CX_MAX; cxi++) {
|
||||
|
||||
(*cx_searcher)++;
|
||||
|
||||
p = gpriv->cx[cxi].sclassifier[dscp];
|
||||
|
||||
while (p!=NULL) {
|
||||
if (p->version == 6) { // verify that this is an IPv4 rule
|
||||
|
||||
|
||||
if ((addr = (unsigned int *)(&(p->daddr.ipv6)))== NULL) {
|
||||
printk("nas_CLASS_cx6: addr is null \n");
|
||||
p = p->next;
|
||||
@@ -409,9 +392,8 @@ struct cx_entity *nas_CLASS_cx6(struct sk_buff *skb,
|
||||
printk("cx %d : %X,%X.%X,%X\n",cxi,addr[0],addr[1],addr[2],addr[3]);
|
||||
#endif //NAS_DEBUG_CLASS
|
||||
|
||||
//if ((dst = (unsigned int*)&(((struct rt6_info *)skbdst)->rt6i_gateway)) == 0){
|
||||
if ( (dst = &((struct iphdr*)(skb_network_header(skb)))->daddr) == NULL) {
|
||||
|
||||
if ( (dst = &((struct iphdr *)(skb_network_header(skb)))->daddr) == NULL) {
|
||||
printk("nas_CLASS_cx6: dst addr is null \n");
|
||||
p = p->next;
|
||||
continue;
|
||||
@@ -446,11 +428,15 @@ struct cx_entity *nas_CLASS_cx6(struct sk_buff *skb,
|
||||
}
|
||||
}
|
||||
|
||||
printk("nas_CLASS_cx6 NOT FOUND: %X.%X.%X.%X\n",
|
||||
dst[0],
|
||||
dst[1],
|
||||
dst[2],
|
||||
dst[3]);
|
||||
|
||||
if (dst ) {
|
||||
printk("nas_CLASS_cx6 NOT FOUND: %X.%X.%X.%X\n",
|
||||
dst[0],
|
||||
dst[1],
|
||||
dst[2],
|
||||
dst[3]);
|
||||
}
|
||||
|
||||
return default_ip;
|
||||
}
|
||||
|
||||
@@ -460,8 +446,7 @@ struct cx_entity *nas_CLASS_cx4(struct sk_buff *skb,
|
||||
unsigned char dscp,
|
||||
struct nas_priv *gpriv,
|
||||
int inst,
|
||||
unsigned char *cx_searcher)
|
||||
{
|
||||
unsigned char *cx_searcher) {
|
||||
//---------------------------------------------------------------------------
|
||||
unsigned char cxi;
|
||||
unsigned char *addr;
|
||||
@@ -473,10 +458,9 @@ struct cx_entity *nas_CLASS_cx4(struct sk_buff *skb,
|
||||
// return(gpriv->cx); //dump to clusterhead
|
||||
|
||||
if (skb!=NULL) {
|
||||
daddr = ((struct iphdr*)(skb_network_header(skb)))->daddr;
|
||||
daddr = ((struct iphdr *)(skb_network_header(skb)))->daddr;
|
||||
|
||||
if (daddr!=0) {
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("[NAS][CLASS][IPv4] Searching for %d.%d.%d.%d\n",
|
||||
((unsigned char *)&daddr)[0],
|
||||
@@ -491,7 +475,6 @@ struct cx_entity *nas_CLASS_cx4(struct sk_buff *skb,
|
||||
|
||||
while (p!=NULL) {
|
||||
if (p->version == 4) { // verify that this is an IPv4 rule
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
addr = (char *)(&(p->daddr.ipv4));
|
||||
printk("found classifier cx %d for destination: %d.%d.%d.%d\n",cxi,addr[0],addr[1],addr[2],addr[3]);
|
||||
@@ -536,32 +519,23 @@ struct cx_entity *nas_CLASS_MPLS(struct sk_buff *skb,
|
||||
unsigned char exp,
|
||||
struct nas_priv *gpriv,
|
||||
int inst,
|
||||
unsigned char *cx_searcher)
|
||||
{
|
||||
unsigned char *cx_searcher) {
|
||||
//---------------------------------------------------------------------------
|
||||
unsigned char cxi;
|
||||
|
||||
struct cx_entity *default_label=NULL;
|
||||
struct classifier_entity *p=NULL;
|
||||
|
||||
// if (inst >0)
|
||||
// return(gpriv->cx); //dump to clusterhead
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
|
||||
|
||||
printk("[NAS][CLASS][MPLS] Searching for label %d\n",MPLSCB(skb)->label);
|
||||
#endif
|
||||
|
||||
for (cxi=*cx_searcher; cxi<NAS_CX_MAX; ++cxi) {
|
||||
|
||||
(*cx_searcher)++;
|
||||
p = gpriv->cx[cxi].sclassifier[exp];
|
||||
|
||||
while (p!=NULL) {
|
||||
if (p->version == NAS_MPLS_VERSION_CODE) { // verify that this is an MPLS rule
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("cx %d : label %d\n",cxi,p->daddr.mpls_label);
|
||||
#endif //NAS_DEBUG_CLASS
|
||||
@@ -588,11 +562,8 @@ struct cx_entity *nas_CLASS_MPLS(struct sk_buff *skb,
|
||||
// goto to next classification rule for the connection
|
||||
p = p->next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return default_label;
|
||||
}
|
||||
|
||||
@@ -600,8 +571,7 @@ struct cx_entity *nas_CLASS_MPLS(struct sk_buff *skb,
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Search the sending function
|
||||
void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
{
|
||||
void nas_CLASS_send(struct sk_buff *skb,int inst) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *p, *sp;
|
||||
uint8_t *protocolh,version;
|
||||
@@ -609,15 +579,10 @@ void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
uint16_t classref;
|
||||
struct cx_entity *cx;
|
||||
//unsigned int i;
|
||||
|
||||
//unsigned int router_adv = 0;
|
||||
struct net_device *dev=nasdev[inst];
|
||||
|
||||
struct nas_priv *gpriv=netdev_priv(dev);
|
||||
|
||||
unsigned char cx_searcher,no_connection=1;
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_SEND: begin - inst %d\n",inst);
|
||||
#endif
|
||||
@@ -629,9 +594,7 @@ void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
|
||||
printk("[NAS][CLASS][SEND] Got packet from kernel:\n");
|
||||
|
||||
for (int i=0; i<256; i++)
|
||||
@@ -641,80 +604,65 @@ void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
#endif
|
||||
// find all connections related to socket
|
||||
cx_searcher = 0;
|
||||
|
||||
no_connection = 1;
|
||||
|
||||
//while (cx_searcher<NAS_CX_MAX) {
|
||||
|
||||
cx = NULL;
|
||||
|
||||
// Address classification
|
||||
switch (ntohs(skb->protocol)) {
|
||||
case ETH_P_IPV6:
|
||||
version = 6;
|
||||
|
||||
protocolh=nas_TOOL_get_protocol6(
|
||||
(struct ipv6hdr *)(skb_network_header(skb)),
|
||||
&protocol);
|
||||
dscp=nas_TOOL_get_dscp6(
|
||||
(struct ipv6hdr *)(skb_network_header(skb))
|
||||
);
|
||||
case ETH_P_IPV6:
|
||||
version = 6;
|
||||
protocolh=nas_TOOL_get_protocol6(
|
||||
(struct ipv6hdr *)(skb_network_header(skb)),
|
||||
&protocol);
|
||||
dscp=nas_TOOL_get_dscp6(
|
||||
(struct ipv6hdr *)(skb_network_header(skb))
|
||||
);
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_SEND: %p %d %p %d %p \n",skb, dscp, gpriv, inst, &cx_searcher);
|
||||
printk("NAS_CLASS_SEND: %p %d %p %d %p \n",skb, dscp, gpriv, inst, &cx_searcher);
|
||||
#endif
|
||||
cx=nas_CLASS_cx6(skb,dscp,gpriv,inst,&cx_searcher);
|
||||
|
||||
|
||||
cx=nas_CLASS_cx6(skb,dscp,gpriv,inst,&cx_searcher);
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_SEND: Got IPv6 packet, dscp = %d\n",dscp);
|
||||
printk("NAS_CLASS_SEND: Got IPv6 packet, dscp = %d\n",dscp);
|
||||
#endif
|
||||
break;
|
||||
break;
|
||||
|
||||
case ETH_P_IP:
|
||||
|
||||
|
||||
dscp=nas_TOOL_get_dscp4((struct iphdr *)(skb_network_header(skb)));
|
||||
cx=nas_CLASS_cx4(skb,dscp,gpriv,inst,&cx_searcher);
|
||||
protocolh=nas_TOOL_get_protocol4(
|
||||
(struct iphdr *)(skb_network_header(skb)),
|
||||
&protocol);
|
||||
case ETH_P_IP:
|
||||
dscp=nas_TOOL_get_dscp4((struct iphdr *)(skb_network_header(skb)));
|
||||
cx=nas_CLASS_cx4(skb,dscp,gpriv,inst,&cx_searcher);
|
||||
protocolh=nas_TOOL_get_protocol4(
|
||||
(struct iphdr *)(skb_network_header(skb)),
|
||||
&protocol);
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_SEND: Got IPv4 packet (%x), dscp = %d, cx = %x\n",ntohs(skb->protocol),dscp,cx);
|
||||
printk("NAS_CLASS_SEND: Got IPv4 packet (%x), dscp = %d, cx = %x\n",ntohs(skb->protocol),dscp,cx);
|
||||
#endif
|
||||
version = 4;
|
||||
|
||||
break;
|
||||
version = 4;
|
||||
break;
|
||||
#ifdef MPLS
|
||||
|
||||
case ETH_P_MPLS_UC:
|
||||
cx=nas_CLASS_MPLS(skb,MPLSCB(skb)->exp,gpriv,inst,&cx_searcher);
|
||||
|
||||
case ETH_P_MPLS_UC:
|
||||
cx=nas_CLASS_MPLS(skb,MPLSCB(skb)->exp,gpriv,inst,&cx_searcher);
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_SEND: Got MPLS unicast packet, exp = %d, label = %d, cx = %x\n",MPLSCB(skb)->exp,MPLSCB(skb)->label,cx);
|
||||
printk("NAS_CLASS_SEND: Got MPLS unicast packet, exp = %d, label = %d, cx = %x\n",MPLSCB(skb)->exp,MPLSCB(skb)->label,cx);
|
||||
#endif
|
||||
dscp = MPLSCB(skb)->exp;
|
||||
version = NAS_MPLS_VERSION_CODE;
|
||||
protocol = version;
|
||||
break;
|
||||
#endif
|
||||
|
||||
dscp = MPLSCB(skb)->exp;
|
||||
version = NAS_MPLS_VERSION_CODE;
|
||||
protocol = version;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
printk("NAS_CLASS_SEND: Unknown protocol\n");
|
||||
version = 0;
|
||||
return;
|
||||
default:
|
||||
printk("NAS_CLASS_SEND: Unknown protocol\n");
|
||||
version = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// If a valid connection for the DSCP/EXP with destination address
|
||||
// is found scan all protocol-based classification rules
|
||||
|
||||
if (cx) {
|
||||
|
||||
classref=0;
|
||||
sp=NULL;
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("[NAS][CLASSIFIER] DSCP/EXP %d : looking for classifier entry\n",dscp);
|
||||
#endif
|
||||
@@ -738,12 +686,10 @@ void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
classref=sp->classref;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (sp!=NULL) {
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
|
||||
char sfct[10], sprotocol[10];
|
||||
|
||||
if (sp->fct==nas_COMMON_QOS_send)
|
||||
@@ -759,42 +705,38 @@ void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
strcpy(sfct, "dc");
|
||||
|
||||
switch(protocol) {
|
||||
case NAS_PROTOCOL_UDP:
|
||||
strcpy(sprotocol, "udp");
|
||||
printk("udp packet\n");
|
||||
break;
|
||||
case NAS_PROTOCOL_UDP:
|
||||
strcpy(sprotocol, "udp");
|
||||
printk("udp packet\n");
|
||||
break;
|
||||
|
||||
case NAS_PROTOCOL_TCP:
|
||||
strcpy(sprotocol, "tcp");
|
||||
printk("tcp packet\n");
|
||||
break;
|
||||
case NAS_PROTOCOL_TCP:
|
||||
strcpy(sprotocol, "tcp");
|
||||
printk("tcp packet\n");
|
||||
break;
|
||||
|
||||
case NAS_PROTOCOL_ICMP4:
|
||||
strcpy(sprotocol, "icmp4");
|
||||
printk("icmp4 packet\n");
|
||||
break;
|
||||
case NAS_PROTOCOL_ICMP4:
|
||||
strcpy(sprotocol, "icmp4");
|
||||
printk("icmp4 packet\n");
|
||||
break;
|
||||
|
||||
case NAS_PROTOCOL_ICMP6:
|
||||
strcpy(sprotocol, "icmp6");
|
||||
print_TOOL_pk_icmp6((struct icmp6hdr*)protocolh);
|
||||
break;
|
||||
case NAS_PROTOCOL_ICMP6:
|
||||
strcpy(sprotocol, "icmp6");
|
||||
print_TOOL_pk_icmp6((struct icmp6hdr *)protocolh);
|
||||
break;
|
||||
#ifdef MPLS
|
||||
|
||||
case NAS_MPLS_VERSION_CODE:
|
||||
strcpy(sprotocol,"mpls");
|
||||
break;
|
||||
case NAS_MPLS_VERSION_CODE:
|
||||
strcpy(sprotocol,"mpls");
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
printk("NAS_CLASS_SEND: (dscp %u, %s) received, (classref %u, fct %s, rab_id %u) classifier rule\n",
|
||||
dscp, sprotocol, sp->classref, sfct, sp->rab_id);
|
||||
#endif
|
||||
|
||||
//printk(" About to trigger a new message sending through nas_CLASS_send \n \n");
|
||||
sp->fct(skb, cx, sp,inst, NULL);
|
||||
|
||||
} // if classifier entry match found
|
||||
|
||||
else {
|
||||
printk("NAS_CLASS_SEND: no corresponding item in the classifier, so the message is dropped\n");
|
||||
// nas_COMMON_del_send(skb, cx, NULL,inst);
|
||||
@@ -803,20 +745,14 @@ void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
no_connection = 0;
|
||||
} // if connection found
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
|
||||
if (no_connection == 1)
|
||||
printk("NAS_CLASS_SEND: no corresponding connection, so the message is dropped\n");
|
||||
|
||||
#endif /* NAS_DEBUG_CLASS */
|
||||
|
||||
|
||||
// } // while loop over connections
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_SEND: end\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@
|
||||
#define NAS_INET6_ADDRSTRLEN 46
|
||||
#define NAS_INET_ADDRSTRLEN 16
|
||||
|
||||
#define NAS_CX_MAX 128 // 32 //Identical to RRC constant
|
||||
#define NAS_CX_MAX 32 //128 //Identical to RRC constant: no you cannot
|
||||
/* increase to 128 without risking stack problems: KEEP ATTENTION TO COMPILATION WARNINGS */
|
||||
//#define NAS_CX_MULTICAST_ALLNODE 2
|
||||
|
||||
#define NAS_RETRY_LIMIT_DEFAULT 5
|
||||
|
||||
@@ -64,7 +64,8 @@
|
||||
// Max number of entry of a message list
|
||||
#define NAS_LIST_CX_MAX 32
|
||||
#define NAS_LIST_RB_MAX 32
|
||||
#define NAS_LIST_CLASS_MAX 32
|
||||
#define NAS_LIST_CLASS_MAX 16 // 32 is too high!!:
|
||||
/* risk of stack problems: KEEP ATTENTION TO COMPILATION WARNINGS */
|
||||
|
||||
typedef unsigned short nasMsgType_t;
|
||||
|
||||
|
||||
@@ -64,6 +64,10 @@
|
||||
#include "rrc_nas_primitives.h"
|
||||
#include "COMMON/platform_types.h"
|
||||
|
||||
#ifndef MAKE_VERSION
|
||||
#define MAKE_VERSION(a,b,c) ((a)*256+(b)*16+(c))
|
||||
#endif
|
||||
|
||||
struct rb_entity {
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasSapId_t sapi;
|
||||
@@ -160,7 +164,7 @@ typedef struct pdcp_data_req_header_s {
|
||||
sdu_size_t data_size;
|
||||
signed int inst;
|
||||
ip_traffic_type_t traffic_type;
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
uint32_t sourceL2Id;
|
||||
uint32_t destinationL2Id;
|
||||
#endif
|
||||
@@ -171,6 +175,10 @@ typedef struct pdcp_data_ind_header_s {
|
||||
sdu_size_t data_size;
|
||||
signed int inst;
|
||||
ip_traffic_type_t dummy_traffic_type;
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
uint32_t sourceL2Id;
|
||||
uint32_t destinationL2Id;
|
||||
#endif
|
||||
} pdcp_data_ind_header_t;
|
||||
|
||||
extern struct net_device *nasdev[NB_INSTANCES_MAX];
|
||||
|
||||
Reference in New Issue
Block a user