Loading include/linux/netfilter_ipv4/ip_nat.h +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ struct ip_nat_range unsigned int flags; /* Inclusive: network order. */ u_int32_t min_ip, max_ip; __be32 min_ip, max_ip; /* Inclusive: network order */ union ip_conntrack_manip_proto min, max; Loading net/ipv4/netfilter/ip_nat_core.c +7 −7 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ static inline unsigned int hash_by_src(const struct ip_conntrack_tuple *tuple) { /* Original src, to ensure we map it consistently if poss. */ return jhash_3words(tuple->src.ip, tuple->src.u.all, return jhash_3words((__force u32)tuple->src.ip, tuple->src.u.all, tuple->dst.protonum, 0) % ip_nat_htable_size; } Loading Loading @@ -190,7 +190,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple, const struct ip_conntrack *conntrack, enum ip_nat_manip_type maniptype) { u_int32_t *var_ipp; __be32 *var_ipp; /* Host order */ u_int32_t minip, maxip, j; Loading @@ -217,7 +217,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple, * like this), even across reboots. */ minip = ntohl(range->min_ip); maxip = ntohl(range->max_ip); j = jhash_2words(tuple->src.ip, tuple->dst.ip, 0); j = jhash_2words((__force u32)tuple->src.ip, (__force u32)tuple->dst.ip, 0); *var_ipp = htonl(minip + j % (maxip - minip + 1)); } Loading Loading @@ -534,9 +534,9 @@ int ip_nat_port_range_to_nfattr(struct sk_buff *skb, const struct ip_nat_range *range) { NFA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(u_int16_t), NFA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(__be16), &range->min.tcp.port); NFA_PUT(skb, CTA_PROTONAT_PORT_MAX, sizeof(u_int16_t), NFA_PUT(skb, CTA_PROTONAT_PORT_MAX, sizeof(__be16), &range->max.tcp.port); return 0; Loading @@ -555,7 +555,7 @@ ip_nat_port_nfattr_to_range(struct nfattr *tb[], struct ip_nat_range *range) if (tb[CTA_PROTONAT_PORT_MIN-1]) { ret = 1; range->min.tcp.port = *(u_int16_t *)NFA_DATA(tb[CTA_PROTONAT_PORT_MIN-1]); *(__be16 *)NFA_DATA(tb[CTA_PROTONAT_PORT_MIN-1]); } if (!tb[CTA_PROTONAT_PORT_MAX-1]) { Loading @@ -564,7 +564,7 @@ ip_nat_port_nfattr_to_range(struct nfattr *tb[], struct ip_nat_range *range) } else { ret = 1; range->max.tcp.port = *(u_int16_t *)NFA_DATA(tb[CTA_PROTONAT_PORT_MAX-1]); *(__be16 *)NFA_DATA(tb[CTA_PROTONAT_PORT_MAX-1]); } return ret; Loading net/ipv4/netfilter/ip_nat_ftp.c +5 −5 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ MODULE_DESCRIPTION("ftp NAT helper"); static int mangle_rfc959_packet(struct sk_buff **pskb, u_int32_t newip, __be32 newip, u_int16_t port, unsigned int matchoff, unsigned int matchlen, Loading @@ -57,7 +57,7 @@ mangle_rfc959_packet(struct sk_buff **pskb, /* |1|132.235.1.2|6275| */ static int mangle_eprt_packet(struct sk_buff **pskb, u_int32_t newip, __be32 newip, u_int16_t port, unsigned int matchoff, unsigned int matchlen, Loading @@ -79,7 +79,7 @@ mangle_eprt_packet(struct sk_buff **pskb, /* |1|132.235.1.2|6275| */ static int mangle_epsv_packet(struct sk_buff **pskb, u_int32_t newip, __be32 newip, u_int16_t port, unsigned int matchoff, unsigned int matchlen, Loading @@ -98,7 +98,7 @@ mangle_epsv_packet(struct sk_buff **pskb, matchlen, buffer, strlen(buffer)); } static int (*mangle[])(struct sk_buff **, u_int32_t, u_int16_t, static int (*mangle[])(struct sk_buff **, __be32, u_int16_t, unsigned int, unsigned int, struct ip_conntrack *, Loading @@ -120,7 +120,7 @@ static unsigned int ip_nat_ftp(struct sk_buff **pskb, struct ip_conntrack_expect *exp, u32 *seq) { u_int32_t newip; __be32 newip; u_int16_t port; int dir = CTINFO2DIR(ctinfo); struct ip_conntrack *ct = exp->master; Loading net/ipv4/netfilter/ip_nat_helper.c +17 −20 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ ip_nat_mangle_tcp_packet(struct sk_buff **pskb, datalen, 0)); } else tcph->check = nf_proto_csum_update(*pskb, htons(oldlen) ^ 0xFFFF, htons(oldlen) ^ htons(0xFFFF), htons(datalen), tcph->check, 1); Loading Loading @@ -267,7 +267,7 @@ ip_nat_mangle_udp_packet(struct sk_buff **pskb, udph->check = -1; } else udph->check = nf_proto_csum_update(*pskb, htons(oldlen) ^ 0xFFFF, htons(oldlen) ^ htons(0xFFFF), htons(datalen), udph->check, 1); return 1; Loading @@ -284,26 +284,24 @@ sack_adjust(struct sk_buff *skb, { while (sackoff < sackend) { struct tcp_sack_block_wire *sack; u_int32_t new_start_seq, new_end_seq; __be32 new_start_seq, new_end_seq; sack = (void *)skb->data + sackoff; if (after(ntohl(sack->start_seq) - natseq->offset_before, natseq->correction_pos)) new_start_seq = ntohl(sack->start_seq) - natseq->offset_after; new_start_seq = htonl(ntohl(sack->start_seq) - natseq->offset_after); else new_start_seq = ntohl(sack->start_seq) - natseq->offset_before; new_start_seq = htonl(new_start_seq); new_start_seq = htonl(ntohl(sack->start_seq) - natseq->offset_before); if (after(ntohl(sack->end_seq) - natseq->offset_before, natseq->correction_pos)) new_end_seq = ntohl(sack->end_seq) - natseq->offset_after; new_end_seq = htonl(ntohl(sack->end_seq) - natseq->offset_after); else new_end_seq = ntohl(sack->end_seq) - natseq->offset_before; new_end_seq = htonl(new_end_seq); new_end_seq = htonl(ntohl(sack->end_seq) - natseq->offset_before); DEBUGP("sack_adjust: start_seq: %d->%d, end_seq: %d->%d\n", ntohl(sack->start_seq), new_start_seq, Loading Loading @@ -375,7 +373,8 @@ ip_nat_seq_adjust(struct sk_buff **pskb, enum ip_conntrack_info ctinfo) { struct tcphdr *tcph; int dir, newseq, newack; int dir; __be32 newseq, newack; struct ip_nat_seq *this_way, *other_way; dir = CTINFO2DIR(ctinfo); Loading @@ -388,17 +387,15 @@ ip_nat_seq_adjust(struct sk_buff **pskb, tcph = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4; if (after(ntohl(tcph->seq), this_way->correction_pos)) newseq = ntohl(tcph->seq) + this_way->offset_after; newseq = htonl(ntohl(tcph->seq) + this_way->offset_after); else newseq = ntohl(tcph->seq) + this_way->offset_before; newseq = htonl(newseq); newseq = htonl(ntohl(tcph->seq) + this_way->offset_before); if (after(ntohl(tcph->ack_seq) - other_way->offset_before, other_way->correction_pos)) newack = ntohl(tcph->ack_seq) - other_way->offset_after; newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_after); else newack = ntohl(tcph->ack_seq) - other_way->offset_before; newack = htonl(newack); newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_before); tcph->check = nf_proto_csum_update(*pskb, ~tcph->seq, newseq, tcph->check, 0); Loading net/ipv4/netfilter/ip_nat_helper_pptp.c +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ #define IP_NAT_PPTP_VERSION "3.0" #define REQ_CID(req, off) (*(u_int16_t *)((char *)(req) + (off))) #define REQ_CID(req, off) (*(__be16 *)((char *)(req) + (off))) MODULE_LICENSE("GPL"); MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); Loading Loading
include/linux/netfilter_ipv4/ip_nat.h +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ struct ip_nat_range unsigned int flags; /* Inclusive: network order. */ u_int32_t min_ip, max_ip; __be32 min_ip, max_ip; /* Inclusive: network order */ union ip_conntrack_manip_proto min, max; Loading
net/ipv4/netfilter/ip_nat_core.c +7 −7 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ static inline unsigned int hash_by_src(const struct ip_conntrack_tuple *tuple) { /* Original src, to ensure we map it consistently if poss. */ return jhash_3words(tuple->src.ip, tuple->src.u.all, return jhash_3words((__force u32)tuple->src.ip, tuple->src.u.all, tuple->dst.protonum, 0) % ip_nat_htable_size; } Loading Loading @@ -190,7 +190,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple, const struct ip_conntrack *conntrack, enum ip_nat_manip_type maniptype) { u_int32_t *var_ipp; __be32 *var_ipp; /* Host order */ u_int32_t minip, maxip, j; Loading @@ -217,7 +217,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple, * like this), even across reboots. */ minip = ntohl(range->min_ip); maxip = ntohl(range->max_ip); j = jhash_2words(tuple->src.ip, tuple->dst.ip, 0); j = jhash_2words((__force u32)tuple->src.ip, (__force u32)tuple->dst.ip, 0); *var_ipp = htonl(minip + j % (maxip - minip + 1)); } Loading Loading @@ -534,9 +534,9 @@ int ip_nat_port_range_to_nfattr(struct sk_buff *skb, const struct ip_nat_range *range) { NFA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(u_int16_t), NFA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(__be16), &range->min.tcp.port); NFA_PUT(skb, CTA_PROTONAT_PORT_MAX, sizeof(u_int16_t), NFA_PUT(skb, CTA_PROTONAT_PORT_MAX, sizeof(__be16), &range->max.tcp.port); return 0; Loading @@ -555,7 +555,7 @@ ip_nat_port_nfattr_to_range(struct nfattr *tb[], struct ip_nat_range *range) if (tb[CTA_PROTONAT_PORT_MIN-1]) { ret = 1; range->min.tcp.port = *(u_int16_t *)NFA_DATA(tb[CTA_PROTONAT_PORT_MIN-1]); *(__be16 *)NFA_DATA(tb[CTA_PROTONAT_PORT_MIN-1]); } if (!tb[CTA_PROTONAT_PORT_MAX-1]) { Loading @@ -564,7 +564,7 @@ ip_nat_port_nfattr_to_range(struct nfattr *tb[], struct ip_nat_range *range) } else { ret = 1; range->max.tcp.port = *(u_int16_t *)NFA_DATA(tb[CTA_PROTONAT_PORT_MAX-1]); *(__be16 *)NFA_DATA(tb[CTA_PROTONAT_PORT_MAX-1]); } return ret; Loading
net/ipv4/netfilter/ip_nat_ftp.c +5 −5 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ MODULE_DESCRIPTION("ftp NAT helper"); static int mangle_rfc959_packet(struct sk_buff **pskb, u_int32_t newip, __be32 newip, u_int16_t port, unsigned int matchoff, unsigned int matchlen, Loading @@ -57,7 +57,7 @@ mangle_rfc959_packet(struct sk_buff **pskb, /* |1|132.235.1.2|6275| */ static int mangle_eprt_packet(struct sk_buff **pskb, u_int32_t newip, __be32 newip, u_int16_t port, unsigned int matchoff, unsigned int matchlen, Loading @@ -79,7 +79,7 @@ mangle_eprt_packet(struct sk_buff **pskb, /* |1|132.235.1.2|6275| */ static int mangle_epsv_packet(struct sk_buff **pskb, u_int32_t newip, __be32 newip, u_int16_t port, unsigned int matchoff, unsigned int matchlen, Loading @@ -98,7 +98,7 @@ mangle_epsv_packet(struct sk_buff **pskb, matchlen, buffer, strlen(buffer)); } static int (*mangle[])(struct sk_buff **, u_int32_t, u_int16_t, static int (*mangle[])(struct sk_buff **, __be32, u_int16_t, unsigned int, unsigned int, struct ip_conntrack *, Loading @@ -120,7 +120,7 @@ static unsigned int ip_nat_ftp(struct sk_buff **pskb, struct ip_conntrack_expect *exp, u32 *seq) { u_int32_t newip; __be32 newip; u_int16_t port; int dir = CTINFO2DIR(ctinfo); struct ip_conntrack *ct = exp->master; Loading
net/ipv4/netfilter/ip_nat_helper.c +17 −20 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ ip_nat_mangle_tcp_packet(struct sk_buff **pskb, datalen, 0)); } else tcph->check = nf_proto_csum_update(*pskb, htons(oldlen) ^ 0xFFFF, htons(oldlen) ^ htons(0xFFFF), htons(datalen), tcph->check, 1); Loading Loading @@ -267,7 +267,7 @@ ip_nat_mangle_udp_packet(struct sk_buff **pskb, udph->check = -1; } else udph->check = nf_proto_csum_update(*pskb, htons(oldlen) ^ 0xFFFF, htons(oldlen) ^ htons(0xFFFF), htons(datalen), udph->check, 1); return 1; Loading @@ -284,26 +284,24 @@ sack_adjust(struct sk_buff *skb, { while (sackoff < sackend) { struct tcp_sack_block_wire *sack; u_int32_t new_start_seq, new_end_seq; __be32 new_start_seq, new_end_seq; sack = (void *)skb->data + sackoff; if (after(ntohl(sack->start_seq) - natseq->offset_before, natseq->correction_pos)) new_start_seq = ntohl(sack->start_seq) - natseq->offset_after; new_start_seq = htonl(ntohl(sack->start_seq) - natseq->offset_after); else new_start_seq = ntohl(sack->start_seq) - natseq->offset_before; new_start_seq = htonl(new_start_seq); new_start_seq = htonl(ntohl(sack->start_seq) - natseq->offset_before); if (after(ntohl(sack->end_seq) - natseq->offset_before, natseq->correction_pos)) new_end_seq = ntohl(sack->end_seq) - natseq->offset_after; new_end_seq = htonl(ntohl(sack->end_seq) - natseq->offset_after); else new_end_seq = ntohl(sack->end_seq) - natseq->offset_before; new_end_seq = htonl(new_end_seq); new_end_seq = htonl(ntohl(sack->end_seq) - natseq->offset_before); DEBUGP("sack_adjust: start_seq: %d->%d, end_seq: %d->%d\n", ntohl(sack->start_seq), new_start_seq, Loading Loading @@ -375,7 +373,8 @@ ip_nat_seq_adjust(struct sk_buff **pskb, enum ip_conntrack_info ctinfo) { struct tcphdr *tcph; int dir, newseq, newack; int dir; __be32 newseq, newack; struct ip_nat_seq *this_way, *other_way; dir = CTINFO2DIR(ctinfo); Loading @@ -388,17 +387,15 @@ ip_nat_seq_adjust(struct sk_buff **pskb, tcph = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4; if (after(ntohl(tcph->seq), this_way->correction_pos)) newseq = ntohl(tcph->seq) + this_way->offset_after; newseq = htonl(ntohl(tcph->seq) + this_way->offset_after); else newseq = ntohl(tcph->seq) + this_way->offset_before; newseq = htonl(newseq); newseq = htonl(ntohl(tcph->seq) + this_way->offset_before); if (after(ntohl(tcph->ack_seq) - other_way->offset_before, other_way->correction_pos)) newack = ntohl(tcph->ack_seq) - other_way->offset_after; newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_after); else newack = ntohl(tcph->ack_seq) - other_way->offset_before; newack = htonl(newack); newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_before); tcph->check = nf_proto_csum_update(*pskb, ~tcph->seq, newseq, tcph->check, 0); Loading
net/ipv4/netfilter/ip_nat_helper_pptp.c +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ #define IP_NAT_PPTP_VERSION "3.0" #define REQ_CID(req, off) (*(u_int16_t *)((char *)(req) + (off))) #define REQ_CID(req, off) (*(__be16 *)((char *)(req) + (off))) MODULE_LICENSE("GPL"); MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); Loading