コード例 #1
0
ファイル: ip_vs_xmit.c プロジェクト: DenisLug/mptcp
/* return NF_STOLEN (sent) or NF_ACCEPT if local=1 (not sent) */
static inline int ip_vs_nat_send_or_cont(int pf, struct sk_buff *skb,
					 struct ip_vs_conn *cp, int local)
{
	int ret = NF_STOLEN;

	skb->ipvs_property = 1;
	if (likely(!(cp->flags & IP_VS_CONN_F_NFCT)))
		ip_vs_notrack(skb);
	else
		ip_vs_update_conntrack(skb, cp, 1);

	/* Remove the early_demux association unless it's bound for the
	 * exact same port and address on this host after translation.
	 */
	if (!local || cp->vport != cp->dport ||
	    !ip_vs_addr_equal(cp->af, &cp->vaddr, &cp->daddr))
		ip_vs_drop_early_demux_sk(skb);

	if (!local) {
		skb_forward_csum(skb);
		if (!skb->sk)
			skb_sender_cpu_clear(skb);
		NF_HOOK(pf, NF_INET_LOCAL_OUT, NULL, skb,
			NULL, skb_dst(skb)->dev, dst_output_sk);
	} else
		ret = NF_ACCEPT;

	return ret;
}
コード例 #2
0
static int ip_forward_finish(struct sock *sk, 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);

    skb_sender_cpu_clear(skb);
    return dst_output_sk(sk, skb);
}
コード例 #3
0
ファイル: ip_vs_xmit.c プロジェクト: DenisLug/mptcp
/* return NF_ACCEPT to allow forwarding or other NF_xxx on error */
static inline int ip_vs_tunnel_xmit_prepare(struct sk_buff *skb,
					    struct ip_vs_conn *cp)
{
	int ret = NF_ACCEPT;

	skb->ipvs_property = 1;
	if (unlikely(cp->flags & IP_VS_CONN_F_NFCT))
		ret = ip_vs_confirm_conntrack(skb);
	if (ret == NF_ACCEPT) {
		nf_reset(skb);
		skb_forward_csum(skb);
		if (!skb->sk)
			skb_sender_cpu_clear(skb);
	}
	return ret;
}
コード例 #4
0
ファイル: ip_vs_xmit.c プロジェクト: DenisLug/mptcp
/* return NF_STOLEN (sent) or NF_ACCEPT if local=1 (not sent) */
static inline int ip_vs_send_or_cont(int pf, struct sk_buff *skb,
				     struct ip_vs_conn *cp, int local)
{
	int ret = NF_STOLEN;

	skb->ipvs_property = 1;
	if (likely(!(cp->flags & IP_VS_CONN_F_NFCT)))
		ip_vs_notrack(skb);
	if (!local) {
		ip_vs_drop_early_demux_sk(skb);
		skb_forward_csum(skb);
		if (!skb->sk)
			skb_sender_cpu_clear(skb);
		NF_HOOK(pf, NF_INET_LOCAL_OUT, NULL, skb,
			NULL, skb_dst(skb)->dev, dst_output_sk);
	} else
		ret = NF_ACCEPT;
	return ret;
}
コード例 #5
0
ファイル: ip6_output.c プロジェクト: guanhe0/kernel
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);
}