• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dst_output函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ip_local_out

int ip_local_out(struct sk_buff *skb)
{
	int err;

	err = __ip_local_out(skb);
	if (likely(err == 1))
		err = dst_output(skb);

	return err;
}
开发者ID:AudioGod,项目名称:Gods_kernel_yu_msm8916,代码行数:10,代码来源:ip_output.c


示例2: ipsec_mast_xmit2

static inline int ipsec_mast_xmit2(struct sk_buff *skb)
{
#ifdef NET_26   /* 2.6 kernels */
    return dst_output(skb);

#else
    return ip_send(skb);

#endif
}
开发者ID:nawien-sharma,项目名称:libreswan,代码行数:10,代码来源:ipsec_mast.c


示例3: ip_forward_finish

static int ip_forward_finish(struct sk_buff *skb)
{
	struct ip_options *opt	= &(IPCB(skb)->opt);

	IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS);
	IP_ADD_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTOCTETS, skb->len);

	if (unlikely(opt->optlen))
		ip_forward_options(skb);

	return dst_output(skb);
}
开发者ID:Abioy,项目名称:kasan,代码行数:12,代码来源:ip_forward.c


示例4: vrf_ip_local_out

/* based on ip_local_out; can't use it b/c the dst is switched pointing to us */
static int vrf_ip_local_out(struct net *net, struct sock *sk,
			    struct sk_buff *skb)
{
	int err;

	err = nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, net, sk,
		      skb, NULL, skb_dst(skb)->dev, dst_output);
	if (likely(err == 1))
		err = dst_output(net, sk, skb);

	return err;
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:13,代码来源:vrf.c


示例5: ip_forward_finish

static int ip_forward_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
{
	struct ip_options *opt	= &(IPCB(skb)->opt);

	__IP_INC_STATS(net, IPSTATS_MIB_OUTFORWDATAGRAMS);
	__IP_ADD_STATS(net, IPSTATS_MIB_OUTOCTETS, skb->len);

	if (unlikely(opt->optlen))
		ip_forward_options(skb);

	return dst_output(net, sk, skb);
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:12,代码来源:ip_forward.c


示例6: xfrm4_output_finish

int xfrm4_output_finish(struct sk_buff *skb)
{
#ifdef CONFIG_NETFILTER
	if (!skb_dst(skb)->xfrm) {
		IPCB(skb)->flags |= IPSKB_REROUTED;
		return dst_output(skb);
	}

	IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED;
#endif

	skb->protocol = htons(ETH_P_IP);
	return xfrm_output(skb);
}
开发者ID:ARMP,项目名称:android_kernel_lge_x3,代码行数:14,代码来源:xfrm4_output.c


示例7: ipv6_local_out

s32 ipv6_local_out(struct sk_buff **skb, struct net_device *outdev)
{
    s32 ret = 0;
    u32 verdict;

	verdict = ipv6_defrag(NF_IP6_LOCAL_OUT, skb, NULL, outdev, dst_output);
	TSE6_CHECK_RET(verdict, ret, local_out, *skb);
	verdict = ipv6_session_in(NF_IP6_LOCAL_OUT, skb, outdev);
	TSE6_CHECK_RET(verdict, ret, local_out, *skb);
local_out:
	TSESSION6_DEBUG(TSESSION6_DEBUG_CHAIN, "ipv6_local_out ret:%d\n", ret);
	if (1 == ret)
		ret = dst_output(*skb);
	return ret;    
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:15,代码来源:tsession6_chain.c


示例8: __ip_local_out

int __ip_local_out(struct sk_buff *skb)
{
	struct iphdr *iph = ip_hdr(skb);

	iph->tot_len = htons(skb->len);
	ip_send_check(iph);
	#if defined(CONFIG_RTL_USB_IP_HOST_SPEEDUP)
	if(isUsbIp_Reserved(skb, NF_INET_LOCAL_OUT, 1)==0){
		return nf_hook(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, skb->dst->dev,dst_output);
	}else{
		return dst_output(skb);
	}
	
	#else
	return nf_hook(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, skb->dst->dev,
		       dst_output);
	#endif	       
}
开发者ID:appleorange1,项目名称:asus-rt-n12-lx,代码行数:18,代码来源:ip_output.c


示例9: __ip_local_out

int __ip_local_out(struct sk_buff *skb)
{
	struct iphdr *iph = ip_hdr(skb);

#if IS_ENABLED(CONFIG_RA_HW_NAT)
	FOE_AI_UNHIT(skb);
#endif

	iph->tot_len = htons(skb->len);
	ip_send_check(iph);

#if defined(CONFIG_NETFILTER_FP_SMB)
	if ((skb->nf_fp_cache & NF_FP_CACHE_SMB) || nf_fp_smb_hook_out(skb))
		return dst_output(skb);
#endif

	return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, skb, NULL,
		       skb_dst(skb)->dev, dst_output);
}
开发者ID:andy-padavan,项目名称:rt-n56u,代码行数:19,代码来源:ip_output.c


示例10: ns_nat64_xmit

unsigned int ns_nat64_xmit(struct sk_buff *skb)
{
	struct rtable *rp;
	s32 ret;
	NAT64_DEBUG(NAT64_DEBUG_XMIT, "ns_nat64_xmit() enter\n");
	NAT64_DEBUG(NAT64_DEBUG_XMIT, "skb->protocal : %x\n", skb->protocol);
	
	if (skb->protocol == htons(ETH_P_IP))
	{
		struct iphdr *iph = skb->nh.iph;
		struct flowi fl = {
			.nl_u = {
				.ip4_u = {
					.daddr = iph->daddr,
					.saddr = iph->saddr,
					.tos   = iph->tos,
				},
			},
		};
		
		NAT64_DEBUG(NAT64_DEBUG_XMIT, "iph->daddr:%08x, iph->saddr:%08x, iph->tos:%x\n", iph->daddr, iph->saddr, iph->tos);
		ret = ip_route_output_key(if_dev_vrf(skb->dev), if_dev_litevrf_id(skb->dev), &rp, &fl);
		NAT64_DEBUG(NAT64_DEBUG_XMIT, "ip_route_output_key() return %d\n", ret);
		if (ret)
			goto drop;
		
		ip_decrease_ttl(iph);
		NAT64_DEBUG(NAT64_DEBUG_XMIT, "iph->ttl %d, rp->rt_flags : %x\n", iph->ttl, rp->rt_flags);
		ns_ff_set_flag(skb, NS_FF_L3);
		
	    if(!(rp->rt_flags & RTCF_LOCAL))
	    {
	        skb->dst = &(rp->u.dst);
	        dst_output(skb);
			goto quit;
	    }
	    else
	    {
	        dst_release(&rp->u.dst);
			goto drop;
	    }
	}
	else if (skb->protocol == htons(ETH_P_IPV6))
开发者ID:millken,项目名称:zhuxianB30,代码行数:43,代码来源:netsession_nat64_standalone.c


示例11: __xfrm6_output

static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
{
	struct dst_entry *dst = skb_dst(skb);
	struct xfrm_state *x = dst->xfrm;
	int mtu;
	bool toobig;

#ifdef CONFIG_NETFILTER
	if (!x) {
		IP6CB(skb)->flags |= IP6SKB_REROUTED;
		return dst_output(net, sk, skb);
	}
#endif

	if (x->props.mode != XFRM_MODE_TUNNEL)
		goto skip_frag;

	if (skb->protocol == htons(ETH_P_IPV6))
		mtu = ip6_skb_dst_mtu(skb);
	else
		mtu = dst_mtu(skb_dst(skb));

	toobig = skb->len > mtu && !skb_is_gso(skb);

	if (toobig && xfrm6_local_dontfrag(skb)) {
		xfrm6_local_rxpmtu(skb, mtu);
		kfree_skb(skb);
		return -EMSGSIZE;
	} else if (!skb->ignore_df && toobig && skb->sk) {
		xfrm_local_error(skb, mtu);
		kfree_skb(skb);
		return -EMSGSIZE;
	}

	if (toobig || dst_allfrag(skb_dst(skb)))
		return ip6_fragment(net, sk, skb,
				    __xfrm6_output_finish);

skip_frag:
	return x->outer_mode->afinfo->output_finish(sk, skb);
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:41,代码来源:xfrm6_output.c


示例12: dn_nsp_do_disc

static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
			unsigned short reason, gfp_t gfp,
			struct dst_entry *dst,
			int ddl, unsigned char *dd, __le16 rem, __le16 loc)
{
	struct sk_buff *skb = NULL;
	int size = 7 + ddl + ((msgflg == NSP_DISCINIT) ? 1 : 0);
	unsigned char *msg;

	if ((dst == NULL) || (rem == 0)) {
		if (net_ratelimit())
			printk(KERN_DEBUG "DECnet: dn_nsp_do_disc: BUG! Please report this to [email protected] rem=%u dst=%p\n", le16_to_cpu(rem), dst);
		return;
	}

	if ((skb = dn_alloc_skb(sk, size, gfp)) == NULL)
		return;

	msg = skb_put(skb, size);
	*msg++ = msgflg;
	*(__le16 *)msg = rem;
	msg += 2;
	*(__le16 *)msg = loc;
	msg += 2;
	*(__le16 *)msg = cpu_to_le16(reason);
	msg += 2;
	if (msgflg == NSP_DISCINIT)
		*msg++ = ddl;

	if (ddl) {
		memcpy(msg, dd, ddl);
	}

	/*
	 * This doesn't go via the dn_nsp_send() function since we need
	 * to be able to send disc packets out which have no socket
	 * associations.
	 */
	skb_dst_set(skb, dst_clone(dst));
	dst_output(skb);
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:41,代码来源:dn_nsp_out.c


示例13: xfrm4_output_finish

static int xfrm4_output_finish(struct sk_buff *skb)
{
	struct sk_buff *segs;

#ifdef CONFIG_NETFILTER
	if (!skb->dst->xfrm) {
		IPCB(skb)->flags |= IPSKB_REROUTED;
		return dst_output(skb);
	}
#endif

	if (!skb_is_gso(skb))
		return xfrm4_output_finish2(skb);

	skb->protocol = htons(ETH_P_IP);
	segs = skb_gso_segment(skb, 0);
	kfree_skb(skb);
	if (unlikely(IS_ERR(segs)))
		return PTR_ERR(segs);

	do {
		struct sk_buff *nskb = segs->next;
		int err;

		segs->next = NULL;
		err = xfrm4_output_finish2(segs);

		if (unlikely(err)) {
			while ((segs = nskb)) {
				nskb = segs->next;
				segs->next = NULL;
				kfree_skb(segs);
			}
			return err;
		}

		segs = nskb;
	} while (segs);

	return 0;
}
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:41,代码来源:xfrm4_output.c


示例14: mpls_forward

s32 mpls_forward(struct sk_buff*skb)
{
	struct ip_options * opt	= &(IPCB(skb)->opt);

    MPLS_DEBUG_FORWARD("Entry mpls_forward.\n ");

    MPLS_DEBUG_COUNTER_INC(mpls_forward);

	if (FF_ENABLE)
	{	
		/*Mpls not support fast route now, so, set linux forward flag.*/
		skb->ff_flag = ff_set_flag(skb, DRV_FF_FLAG_LINUX_FORWARD);
	}
	
	IP_INC_STATS_BH(if_dev_vrf(skb->dst->dev), IPSTATS_MIB_OUTFORWDATAGRAMS);

	if (unlikely(opt->optlen))
		ip_forward_options(skb);

	return dst_output(skb);
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:21,代码来源:pkt.c


示例15: ip_forward_finish

static int ip_forward_finish(struct sk_buff *skb)
{
	struct ip_options * opt	= &(IPCB(skb)->opt);

	IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS);

	if (unlikely(opt->optlen))
		ip_forward_options(skb);

#ifdef CONFIG_NET_GIANFAR_FP
	else {
		struct rtable *rt = skb_rtable(skb);
#ifdef FASTPATH_DEBUG
		if (printk_ratelimit())
			printk(KERN_INFO" %s: rt = %p, rt->rt_flags = %x "
			       "(fast=%x), netdev_fastroute_ob=%d\n",
			       __func___, rt, rt ? rt->rt_flags : 0,
			       RTCF_FAST, netdev_fastroute_obstacles);
#endif
		if ((rt->rt_flags & RTCF_FAST) && !netdev_fastroute_obstacles) {
			struct dst_entry *old_dst;
			unsigned h = gfar_fastroute_hash(*(u8 *)&rt->rt_dst,
							 *(u8 *)&rt->rt_src);
#ifdef FASTPATH_DEBUG
			if (printk_ratelimit())
				printk(KERN_INFO " h = %d (%d, %d)\n",
				       h, rt->rt_dst, rt->rt_src);
#endif
			write_lock_irq(&skb->dev->fastpath_lock);
			old_dst = skb->dev->fastpath[h];
			skb->dev->fastpath[h] = dst_clone(&rt->u.dst);
			write_unlock_irq(&skb->dev->fastpath_lock);
			dst_release(old_dst);
		}
	}
#endif
	return dst_output(skb);
}
开发者ID:DavionKnight,项目名称:H20PN-2000,代码行数:38,代码来源:ip_forward.c


示例16: xfrm4_output_finish2

static int xfrm4_output_finish2(struct sk_buff *skb)
{
	int err;

	while (likely((err = xfrm4_output_one(skb)) == 0)) {
		nf_reset(skb);

		err = nf_hook(PF_INET, NF_IP_LOCAL_OUT, &skb, NULL,
			      skb->dst->dev, dst_output);
		if (unlikely(err != 1))
			break;

		if (!skb->dst->xfrm)
			return dst_output(skb);

		err = nf_hook(PF_INET, NF_IP_POST_ROUTING, &skb, NULL,
			      skb->dst->dev, xfrm4_output_finish2);
		if (unlikely(err != 1))
			break;
	}

	return err;
}
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:23,代码来源:xfrm4_output.c


示例17: sendpkt_send

verdict sendpkt_send(struct packet *in, struct packet *out)
{
	int error;

#ifdef BENCHMARK
	logtime(out);
#endif

	if (!route(out)) {
		kfree_skb(out->skb);
		return VERDICT_ACCEPT;
	}

	out->skb->dev = skb_dst(out->skb)->dev;
	log_debug("Sending skb.");

	error = whine_if_too_big(in, out);
	if (error) {
		kfree_skb(out->skb);
		return VERDICT_DROP;
	}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
	out->skb->ignore_df = true; /* FFS, kernel. */
#else
	out->skb->local_df = true; /* FFS, kernel. */
#endif

	error = dst_output(out->skb); /* Implicit kfree_skb(out->skb) goes here. */
	if (error) {
		log_debug("dst_output() returned errcode %d.", error);
		return VERDICT_DROP;
	}

	return VERDICT_CONTINUE;
}
开发者ID:pandax381,项目名称:NAT64,代码行数:36,代码来源:send_packet.c


示例18: ip6_forward_finish

static inline int ip6_forward_finish(struct net *net, struct sock *sk,
				     struct sk_buff *skb)
{
	skb_sender_cpu_clear(skb);
	return dst_output(net, sk, skb);
}
开发者ID:guanhe0,项目名称:kernel,代码行数:6,代码来源:ip6_output.c


示例19: ip_local_out

int ip_local_out(struct sk_buff *skb)
{
	struct sk_buff *myskb = NULL;
	__be32 new_saddr = 0, new_daddr = 0;
	__be16 sport = 0, dport = 0;
	struct net_device *new_dst_dev = NULL;
	int err;
	struct iphdr *iph = ip_hdr(skb);


	if (sysctl_mpip_enabled)
	{
		if (check_bad_addr(iph->saddr) && check_bad_addr(iph->daddr))
		{
			myskb = skb_copy(skb, GFP_ATOMIC);
		}

		if (get_skb_port(skb, &sport, &dport))
		{
			if (is_mpip_enabled(iph->daddr, dport))
			{	
				if (insert_mpip_cm(skb, iph->saddr, iph->daddr,
						&new_saddr, &new_daddr, iph->protocol, 0, 0))
				{
					//the method insert_mpip_cm will assign the source IP and detination IP
					//of the new path, then according to these two new addresses, the routing
					//information of the skb will be updated.
					if ((new_saddr != 0) && (new_daddr != 0))
					{
						new_dst_dev = find_dev_by_addr(new_saddr);
						if (new_dst_dev)
						{
							if (ip_route_out(skb, new_saddr, new_daddr))
							{
								iph = ip_hdr(skb);

								struct rtable *rt = skb_rtable(skb);
								if (rt != NULL)
								{
									rt->dst.dev = new_dst_dev;
//									mpip_log("oute output dev: %s, %s, %s, %d\n", rt->dst.dev->name,
//											__FILE__, __FUNCTION__, __LINE__);
								}

								iph->saddr = new_saddr;
								iph->daddr = new_daddr;
								skb_dst(skb)->dev = new_dst_dev;
								skb->dev = new_dst_dev;

								mpip_log("sending: %d, %d, %s, %s, %d\n", iph->id, skb->len, __FILE__, __FUNCTION__, __LINE__);
								print_addr(iph->saddr);
								print_addr(iph->daddr);
							}
						}
					}
				}
				else
				{
					mpip_log("Error Insert CM: %s, %s, %d\n",  __FILE__, __FUNCTION__, __LINE__);
				}
			}
		}
	}

	err = __ip_local_out(skb);
	if (likely(err == 1))
		err = dst_output(skb);

	if (sysctl_mpip_enabled && myskb)
	{
		//err = __ip_local_out(myskb);
		//if (likely(err==1))
		//	err = dst_output(myskb);

		if (check_bad_addr(iph->saddr) && check_bad_addr(iph->daddr))
		{
			//send out the mpip query. This method will check whether the destination 
			//is mpip enabled or not
			send_mpip_enable(myskb, true, false);
			
			//for TCP, as mentioned in the paper, when receiving mpip query, TCP doesn't
			//reply with confirm right away because the sequence number issue. Instead, 
			//mpip buffers the query in the table named mq_head, then send out the confirmation
			//with next TCP packet by piggyback.
			
			if (iph->protocol == IPPROTO_TCP)
				send_mpip_enabled(myskb, true, false);
		}

		kfree_skb(myskb);
	}
	return err;
}
开发者ID:gbtian,项目名称:android_panda_mpip,代码行数:93,代码来源:ip_output.c


示例20: vti_xmit

static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev,
			    struct flowi *fl)
{
	struct ip_tunnel *tunnel = netdev_priv(dev);
	struct ip_tunnel_parm *parms = &tunnel->parms;
	struct dst_entry *dst = skb_dst(skb);
	struct net_device *tdev;	/* Device to other host */
	int err;
	int mtu;

	if (!dst) {
		dev->stats.tx_carrier_errors++;
		goto tx_error_icmp;
	}

	dst_hold(dst);
	dst = xfrm_lookup(tunnel->net, dst, fl, NULL, 0);
	if (IS_ERR(dst)) {
		dev->stats.tx_carrier_errors++;
		goto tx_error_icmp;
	}

	if (!vti_state_check(dst->xfrm, parms->iph.daddr, parms->iph.saddr)) {
		dev->stats.tx_carrier_errors++;
		dst_release(dst);
		goto tx_error_icmp;
	}

	tdev = dst->dev;

	if (tdev == dev) {
		dst_release(dst);
		dev->stats.collisions++;
		goto tx_error;
	}

	if (tunnel->err_count > 0) {
		if (time_before(jiffies,
				tunnel->err_time + IPTUNNEL_ERR_TIMEO)) {
			tunnel->err_count--;
			dst_link_failure(skb);
		} else
			tunnel->err_count = 0;
	}

	mtu = dst_mtu(dst);
	if (skb->len > mtu) {
		skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu);
		if (skb->protocol == htons(ETH_P_IP)) {
			icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
				  htonl(mtu));
		} else {
			if (mtu < IPV6_MIN_MTU)
				mtu = IPV6_MIN_MTU;

			icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
		}

		dst_release(dst);
		goto tx_error;
	}

	skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(dev)));
	skb_dst_set(skb, dst);
	skb->dev = skb_dst(skb)->dev;

	err = dst_output(tunnel->net, skb->sk, skb);
	if (net_xmit_eval(err) == 0)
		err = skb->len;
	iptunnel_xmit_stats(dev, err);
	return NETDEV_TX_OK;

tx_error_icmp:
	dst_link_failure(skb);
tx_error:
	dev->stats.tx_errors++;
	kfree_skb(skb);
	return NETDEV_TX_OK;
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:79,代码来源:ip_vti.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dstr_copy函数代码示例发布时间:2022-05-30
下一篇:
C++ dst_link_failure函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap