This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GRE Protocol packets reception in NDK.

Hi All,

         I am developing an guest-server program and which requires me to get GRE packets in NDK. I do understand, that significant amount of code changes are required as part of NDK and i am writing those. I have few questions on GRE protocol.

1. In the Pa_addIP(), i see a field called GRE_Proto field [  uint16_t    greProto;  /**<  GRE protocol field */], so i expect the value to be 47. Is that correct?

2. Assuming that i did step1, Is PA capable of handing over GRE Packets to NDK code? [please note, i will be writing the code for doing parsing/processing/forwarding in NDK]

3. can i set two routes/rules, does this work [given below ]

route1  : -            MAC1 ==> IP1 ==> Port1 ==> handover to NDK [regular TCP/UDP packets]

route2 : -             MAC1 ==> IP1+GRE(47) ==>Port1  ==> handover to NDK. [GRE packets, i will be writing the code for this Rx Path].

my expectation is that TCP/UDP packets will take a different flow and GRE packets should take a different flow by doing above. Let me know the feasibility of GRE Packets reception by above setting of route2/rules.

Thanks

RC Reddy

  • Hi, RC:

    Please see my  answers below:

    1. In the Pa_addIP(), i see a field called GRE_Proto field [  uint16_t    greProto;  /**<  GRE protocol field */], so i expect the value to be 47. Is that correct?

    [Eric] If you only want to deliver GRE packet to a particular queue, you need to set proto to 47 instead. The greProto is used to classify based on the proto field within GRE.

    2. Assuming that i did step1, Is PA capable of handing over GRE Packets to NDK code? [please note, i will be writing the code for doing parsing/processing/forwarding in NDK]

    [Eric] I am not sure. Does NDK allow IP rules? Even if it does not, it should be pretty easy to enable this feature.

    3. can i set two routes/rules, does this work [given below ]

    route1  : -            MAC1 ==> IP1 ==> Port1 ==> handover to NDK [regular TCP/UDP packets]

    route2 : -             MAC1 ==> IP1+GRE(47) ==>Port1  ==> handover to NDK. [GRE packets, i will be writing the code for this Rx Path].

    my expectation is that TCP/UDP packets will take a different flow and GRE packets should take a different flow by doing above. Let me know the feasibility of GRE Packets reception by above setting of route2/rules.

    [Eric] Yes, you can confiure different routeInfo with different destination queue, flow Id or swInfo0 for route1 and route2. Please note that you need to add route1 at first since rout2 traffic will match route1 rule as well. Please note also that all non-GRE packets  including ICMP  will go into NDK through route1.  It may be easier to add your GRE parsing function within NDK with route1 only.

    Best regards,

    Eric

     

     

  • Hi Eric,

                Thanks for your reply and I did not understand your reply. Let me put it in detailed, please correct me if i am wrong.

    paIpInfo_t = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP source = dont care */
                          { 0xc0, 0xa8, 0x01, 0xb1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP dest */
                          0, /* SPI = dont care */
                          0, /* flow = dont care */
                          pa_IPV4, /* IP type */
                          0, /* GRE protocol */
                          17, /* Ip protocol = dont care (TCP or UDP or anything else) */
                          0, /* TOS */
                          FALSE, /* TOS = dont care (seperate field since TOS=0 is valid */
                          0 /* SCTP destination port = dont care */
    };

    In above paIpInfo_t for catching only GRE packets. Following are the changes, please correct if any wrong

    paIpInfo_t = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP source = dont care */
                          { 0xc0, 0xa8, 0x01, 0xb1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP dest */
                          0, /* SPI = dont care */
                          0, /* flow = dont care */
                          pa_IPV4, /* IP type */
                          47, /* GRE protocol */
                          0, /* Ip protocol = dont care (TCP or UDP or anything else) */
                          0, /* TOS */
                          FALSE, /* TOS = dont care (seperate field since TOS=0 is valid */
                          0 /* SCTP destination port = dont care */
    };

    I didn't under this line, can you please explain in detail "The greProto is used to classify based on the proto field within GRE."

    According to my expectation, GRE Over ICMP and GRE over IGMP packets should reach route2. I understand ICMP and IGMP take route 1, but what about GRE over ICMP and GRE over IGMP?

    Thanks

    RC Reddy

  • Hi, RC:

    What I suggest is for GRE over IP (MAC/IP/GRE) packet? In this case, the protocol field in the IP header should be 47 so that you need to set "proto"  to 47 to match this type of packet. The PASS will further classify the packet with optional protocol field within the GRE header if you specify the parameter greProt.

    I can not find any data for GRE over ICMP? Based on the name, the GRE over ICMP packet should look like MAC/IP/ICMP/GRE, which will be treated as a normal ICMP packet.

    Best regards,

    Eric

     

  • Hi Eric,

                For GRE+ICMP, i mean this

    http://packetlife.net/captures/GRE.cap

    [

    GRE.cap (1.5 KB)

    ]

    Thanks

    RCReddy

  • Hi, RC:

    It is an IP over GRE packet. To classify this type of packet, you should set proto to 47 anf greProto to 0x0800. If you jst want to identify GRE packet, you can set greProto to 0 (Don't care).

    Best regards,

    Eric