netfilter:Changes to Allow IRC DCC
Existing IRC conntrack code does source address translation for TCP handshake packets, when they are initiated from outside client. Since the data transfer happens through Hardware Accelarator, source translation will not happen and hence data transfer fails. We can fix this by preventing source address translation during handshake. Change-Id: I613435a53ab58db51505afe057bfbec68259e277 Signed-off-by: Ravinder Konka <rkonka@codeaurora.org>
This commit is contained in:
parent
46ff9a2189
commit
6398a23359
|
@ -26,6 +26,29 @@ MODULE_DESCRIPTION("IRC (DCC) NAT helper");
|
|||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("ip_nat_irc");
|
||||
|
||||
/* Specific API required since the data connection will go through a hardware
|
||||
* accelerator and it will expect data to be coming from IRC server instead
|
||||
* of endclient if the source IP is mangled as in the case of
|
||||
* nf_nat_follow_master API
|
||||
*/
|
||||
void nf_nat_follow_master_irc(struct nf_conn *ct,
|
||||
struct nf_conntrack_expect *exp)
|
||||
{
|
||||
struct nf_nat_range range;
|
||||
|
||||
/* This must be a fresh one. */
|
||||
BUG_ON(ct->status & IPS_NAT_DONE_MASK);
|
||||
|
||||
|
||||
/* For DST manip, map port here to where it's expected. */
|
||||
range.flags = (NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED);
|
||||
range.min_proto = range.max_proto = exp->saved_proto;
|
||||
range.min_addr = range.max_addr
|
||||
= ct->master->tuplehash[!exp->dir].tuple.src.u3;
|
||||
nf_nat_setup_info(ct, &range, NF_NAT_MANIP_DST);
|
||||
}
|
||||
|
||||
|
||||
static unsigned int help(struct sk_buff *skb,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned int protoff,
|
||||
|
@ -44,7 +67,7 @@ static unsigned int help(struct sk_buff *skb,
|
|||
|
||||
exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port;
|
||||
exp->dir = IP_CT_DIR_REPLY;
|
||||
exp->expectfn = nf_nat_follow_master;
|
||||
exp->expectfn = nf_nat_follow_master_irc;
|
||||
|
||||
/* Try to get same port: if not, try to change it. */
|
||||
for (port = ntohs(exp->saved_proto.tcp.port); port != 0; port++) {
|
||||
|
|
Loading…
Reference in New Issue