您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ tcf_csum_skb_nextlayer函数代码示例

51自学网 2021-06-03 08:41:51
  C++
这篇教程C++ tcf_csum_skb_nextlayer函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中tcf_csum_skb_nextlayer函数的典型用法代码示例。如果您正苦于以下问题:C++ tcf_csum_skb_nextlayer函数的具体用法?C++ tcf_csum_skb_nextlayer怎么用?C++ tcf_csum_skb_nextlayer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了tcf_csum_skb_nextlayer函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: tcf_csum_ipv4_udp

static int tcf_csum_ipv4_udp(struct sk_buff *skb, unsigned int ihl,			     unsigned int ipl, int udplite){	struct udphdr *udph;	const struct iphdr *iph;	u16 ul;	if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_UDP)		return 1;	/*	 * Support both UDP and UDPLITE checksum algorithms, Don't use	 * udph->len to get the real length without any protocol check,	 * UDPLITE uses udph->len for another thing,	 * Use iph->tot_len, or just ipl.	 */	udph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*udph));	if (udph == NULL)		return 0;	iph = ip_hdr(skb);	ul = ntohs(udph->len);	if (udplite || udph->check) {		udph->check = 0;		if (udplite) {			if (ul == 0)				skb->csum = csum_partial(udph, ipl - ihl, 0);			else if ((ul >= sizeof(*udph)) && (ul <= ipl - ihl))				skb->csum = csum_partial(udph, ul, 0);			else				goto ignore_obscure_skb;		} else {			if (ul != ipl - ihl)				goto ignore_obscure_skb;			skb->csum = csum_partial(udph, ul, 0);		}		udph->check = csum_tcpudp_magic(iph->saddr, iph->daddr,						ul, iph->protocol,						skb->csum);		if (!udph->check)			udph->check = CSUM_MANGLED_0;	}	skb->ip_summed = CHECKSUM_NONE;ignore_obscure_skb:	return 1;}
开发者ID:asmalldev,项目名称:linux,代码行数:55,


示例2: tcf_csum_ipv6_udp

static int tcf_csum_ipv6_udp(struct sk_buff *skb,			     unsigned int ihl, unsigned int ipl, int udplite){	struct udphdr *udph;	const struct ipv6hdr *ip6h;	u16 ul;	/*	 * Support both UDP and UDPLITE checksum algorithms, Don't use	 * udph->len to get the real length without any protocol check,	 * UDPLITE uses udph->len for another thing,	 * Use ip6h->payload_len + sizeof(*ip6h) ... , or just ipl.	 */	udph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*udph));	if (udph == NULL)		return 0;	ip6h = ipv6_hdr(skb);	ul = ntohs(udph->len);	udph->check = 0;	if (udplite) {		if (ul == 0)			skb->csum = csum_partial(udph, ipl - ihl, 0);		else if ((ul >= sizeof(*udph)) && (ul <= ipl - ihl))			skb->csum = csum_partial(udph, ul, 0);		else			goto ignore_obscure_skb;	} else {		if (ul != ipl - ihl)			goto ignore_obscure_skb;		skb->csum = csum_partial(udph, ul, 0);	}	udph->check = csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr, ul,				      udplite ? IPPROTO_UDPLITE : IPPROTO_UDP,				      skb->csum);	if (!udph->check)		udph->check = CSUM_MANGLED_0;	skb->ip_summed = CHECKSUM_NONE;ignore_obscure_skb:	return 1;}
开发者ID:513855417,项目名称:linux,代码行数:51,


示例3: tcf_csum_sctp

static int tcf_csum_sctp(struct sk_buff *skb, unsigned int ihl,			 unsigned int ipl){	struct sctphdr *sctph;	if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_SCTP)		return 1;	sctph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*sctph));	if (!sctph)		return 0;	sctph->checksum = sctp_compute_cksum(skb,					     skb_network_offset(skb) + ihl);	skb->ip_summed = CHECKSUM_NONE;	return 1;}
开发者ID:asmalldev,项目名称:linux,代码行数:18,


示例4: tcf_csum_ipv4_udp

static int tcf_csum_ipv4_udp(struct sk_buff *skb, struct iphdr *iph,			     unsigned int ihl, unsigned int ipl, int udplite){	struct udphdr *udph;	u16 ul;	udph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*udph));	if (udph == NULL)		return 0;	ul = ntohs(udph->len);	if (udplite || udph->check) {		udph->check = 0;		if (udplite) {			if (ul == 0)				skb->csum = csum_partial(udph, ipl - ihl, 0);			else if ((ul >= sizeof(*udph)) && (ul <= ipl - ihl))				skb->csum = csum_partial(udph, ul, 0);			else				goto ignore_obscure_skb;		} else {			if (ul != ipl - ihl)				goto ignore_obscure_skb;			skb->csum = csum_partial(udph, ul, 0);		}		udph->check = csum_tcpudp_magic(iph->saddr, iph->daddr,						ul, iph->protocol,						skb->csum);		if (!udph->check)			udph->check = CSUM_MANGLED_0;	}	skb->ip_summed = CHECKSUM_NONE;ignore_obscure_skb:	return 1;}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:44,


示例5: tcf_csum_ipv6_tcp

static int tcf_csum_ipv6_tcp(struct sk_buff *skb,			     unsigned int ihl, unsigned int ipl){	struct tcphdr *tcph;	const struct ipv6hdr *ip6h;	tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph));	if (tcph == NULL)		return 0;	ip6h = ipv6_hdr(skb);	tcph->check = 0;	skb->csum = csum_partial(tcph, ipl - ihl, 0);	tcph->check = csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,				      ipl - ihl, IPPROTO_TCP,				      skb->csum);	skb->ip_summed = CHECKSUM_NONE;	return 1;}
开发者ID:513855417,项目名称:linux,代码行数:21,


示例6: tcf_csum_ipv4_tcp

static int tcf_csum_ipv4_tcp(struct sk_buff *skb, unsigned int ihl,			     unsigned int ipl){	struct tcphdr *tcph;	const struct iphdr *iph;	if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4)		return 1;	tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph));	if (tcph == NULL)		return 0;	iph = ip_hdr(skb);	tcph->check = 0;	skb->csum = csum_partial(tcph, ipl - ihl, 0);	tcph->check = tcp_v4_check(ipl - ihl,				   iph->saddr, iph->daddr, skb->csum);	skb->ip_summed = CHECKSUM_NONE;	return 1;}
开发者ID:asmalldev,项目名称:linux,代码行数:23,



注:本文中的tcf_csum_skb_nextlayer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tcf_hash函数代码示例
C++ tcdrain函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。