【OVS2.5.0源码分析】datapath之action分析(5)

本文深入探讨了OpenvSwitch OVS2.5.0的源码,重点关注了在datapath层的action处理,特别是OVS_ACTION_ATTR_SET的实现。文章通过分析`execute_set_action`函数及其调用的`vxlan_xmit`函数,揭示了OVS如何进行数据包的set动作处理和VXLAN隧道发送流程。
摘要由CSDN通过智能技术生成

今天分析OVS_ACTION_ATTR_SET action的处理函数execute_set_action函数。

1、execute_set_action函数

static int execute_set_action(struct sk_buff *skb,
			      struct sw_flow_key *flow_key,
			      const struct nlattr *a)
{
	/* Only tunnel set execution is supported without a mask. */
	if (nla_type(a) == OVS_KEY_ATTR_TUNNEL_INFO) {
		struct ovs_tunnel_info *tun = nla_data(a);

		ovs_skb_dst_drop(skb);                                     
		ovs_dst_hold((struct dst_entry *)tun->tun_dst);            //为什么要调用空函数
		ovs_skb_dst_set(skb, (struct dst_entry *)tun->tun_dst);    //设置skb的tun_dst成员对象,这个信息在vxlan报文发包的时候使用
		return 0;
	}

	return -EINVAL;
}
该action的处理函数非常简单,仅设置了一个参数。 我们来看看是如何被使用到的,以vxlan隧道为例,我们从vxlan端口的send函数(vxlan_xmit)入手来看。

2、vxlan_xmit函数

#define vxlan_xmit rpl_vxlan_xmit
netdev_tx_t rpl_vxlan_xmit(struct sk
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值