[ovs-dev] [ovs-discuss] query related to GRE encapsulation

Chetan Bali chetan.bali at aricent.com
Tue Feb 24 17:00:31 UTC 2015


Hi Ben,

Thanks for the quick response. Please find the code snippet below:

This below function is called from flow_put in dpif class code.

uint8_t dpif_tunnel_parse_actions(s_action_t *action_list, const struct nlattr *actions, size_t actions_len, struct flow_tnl *tun_param)
{
if(OVS_LIKELY(NULL != actions))
    {
        NL_ATTR_FOR_EACH_UNSAFE(a, len, actions, actions_len)
        {
            switch (nl_attr_type(a))
            {
                case OVS_ACTION_ATTR_SET:
                    VLOG_INFO("Action type is ACTION_SET \n");
                        action_list[num_action].action_type = ACTION_SET_IPV4_TUNNEL;
                    if (nla_type(nla_data(a)) == OVS_KEY_ATTR_TUNNEL)
                    {
                        tun_param = nla_data(nla_data(a));
                        VLOG_INFO(" OVS_ACTION_ATTR_TUNNEL TUN_ID : %u\n",tun_param->tun_id);
                        VLOG_INFO(" OVS_ACTION_ATTR_TUNNEL SRC_ADRR : %x\n",ntohl(tun_param->ipv4_src));
                        VLOG_INFO(" OVS_ACTION_ATTR_TUNNEL SRC_DST : %x\n",ntohl(tun_param->ipv4_dst));
                        VLOG_INFO(" OVS_ACTION_ATTR_TUNNEL TUN_FLAG : %u\n",tun_param->tun_flags);
                        VLOG_INFO(" OVS_ACTION_ATTR_TUNNEL TOS : %u\n",tun_param->ipv4_tos);
                        VLOG_INFO(" OVS_ACTION_ATTR_TUNNEL TTL : %u\n",tun_param->ipv4_ttl);
                    }

We are not getting correct values of tun_id, tun_src, tun_dst, tun_ttl, etc.

It will be great if you could help us here.

Thanks
Chetan Bali

-----Original Message-----
From: Ben Pfaff [mailto:blp at nicira.com]
Sent: 24 February 2015 22:15
To: Chetan Bali
Cc: dev at openvswitch.org; discuss at openvswitch.org; Mohit Malik
Subject: Re: [ovs-discuss] query related to GRE encapsulation

On Tue, Feb 24, 2015 at 01:33:29PM +0000, Chetan Bali wrote:
> I am configuring gre-port in my ovs bridge, for establishing
> gre-tunnel between 2 machines. I am trying to parse the tunnelling key params sent by OVS while adding flow, when it sets action as OVS_ACTION_ATTR_SET. I am parsing the tun-key attributes in dpif-linux.c in exact manner as ovs does, i.e., nla_data(nla_data(action)) where action is in "nlattr"  type. Tun-key params that I am trying to fetch are as per struct "ovs_key_ipv4_tunnel" i.e., struct ovs_key_ipv4_tunnel {
>     __be64 tun_id;
>     __be32 ipv4_src;
>     __be32 ipv4_dst;
>     __be16 tun_flags;
>     u8   ipv4_tos;
>     u8   ipv4_ttl;
> };
> The problem is that, while parsing I am getting incorrect tun-key params, whereas I can see by putting prints that openvswitchd.ko is getting correct tun-key params.

I guess you're doing something wrong.  Show us your code?
"DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of the individual to whom it is addressed. It may contain privileged or confidential information and should not be circulated or used for any purpose other than for what it is intended. If you have received this message in error, please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly prohibited from using, copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including damage from virus."



More information about the dev mailing list