|
@@ -103,8 +103,7 @@ static int udp_new(struct nf_conn *conntrack, const struct sk_buff *skb,
|
|
static int udp_error(struct sk_buff *skb, unsigned int dataoff,
|
|
static int udp_error(struct sk_buff *skb, unsigned int dataoff,
|
|
enum ip_conntrack_info *ctinfo,
|
|
enum ip_conntrack_info *ctinfo,
|
|
int pf,
|
|
int pf,
|
|
- unsigned int hooknum,
|
|
|
|
- int (*csum)(const struct sk_buff *, unsigned int))
|
|
|
|
|
|
+ unsigned int hooknum)
|
|
{
|
|
{
|
|
unsigned int udplen = skb->len - dataoff;
|
|
unsigned int udplen = skb->len - dataoff;
|
|
struct udphdr _hdr, *hdr;
|
|
struct udphdr _hdr, *hdr;
|
|
@@ -136,9 +135,8 @@ static int udp_error(struct sk_buff *skb, unsigned int dataoff,
|
|
* and moreover root might send raw packets.
|
|
* and moreover root might send raw packets.
|
|
* FIXME: Source route IP option packets --RR */
|
|
* FIXME: Source route IP option packets --RR */
|
|
if (((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) ||
|
|
if (((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) ||
|
|
- (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING))
|
|
|
|
- && skb->ip_summed != CHECKSUM_UNNECESSARY
|
|
|
|
- && csum(skb, dataoff)) {
|
|
|
|
|
|
+ (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) &&
|
|
|
|
+ nf_checksum(skb, hooknum, dataoff, IPPROTO_UDP, pf)) {
|
|
if (LOG_INVALID(IPPROTO_UDP))
|
|
if (LOG_INVALID(IPPROTO_UDP))
|
|
nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
|
|
nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
|
|
"nf_ct_udp: bad UDP checksum ");
|
|
"nf_ct_udp: bad UDP checksum ");
|
|
@@ -148,44 +146,6 @@ static int udp_error(struct sk_buff *skb, unsigned int dataoff,
|
|
return NF_ACCEPT;
|
|
return NF_ACCEPT;
|
|
}
|
|
}
|
|
|
|
|
|
-static int csum4(const struct sk_buff *skb, unsigned int dataoff)
|
|
|
|
-{
|
|
|
|
- return csum_tcpudp_magic(skb->nh.iph->saddr, skb->nh.iph->daddr,
|
|
|
|
- skb->len - dataoff, IPPROTO_UDP,
|
|
|
|
- skb->ip_summed == CHECKSUM_HW ? skb->csum
|
|
|
|
- : skb_checksum(skb, dataoff,
|
|
|
|
- skb->len - dataoff, 0));
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static int csum6(const struct sk_buff *skb, unsigned int dataoff)
|
|
|
|
-{
|
|
|
|
- return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
|
|
|
|
- skb->len - dataoff, IPPROTO_UDP,
|
|
|
|
- skb->ip_summed == CHECKSUM_HW
|
|
|
|
- ? csum_sub(skb->csum,
|
|
|
|
- skb_checksum(skb, 0, dataoff, 0))
|
|
|
|
- : skb_checksum(skb, dataoff, skb->len - dataoff,
|
|
|
|
- 0));
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static int udp_error4(struct sk_buff *skb,
|
|
|
|
- unsigned int dataoff,
|
|
|
|
- enum ip_conntrack_info *ctinfo,
|
|
|
|
- int pf,
|
|
|
|
- unsigned int hooknum)
|
|
|
|
-{
|
|
|
|
- return udp_error(skb, dataoff, ctinfo, pf, hooknum, csum4);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static int udp_error6(struct sk_buff *skb,
|
|
|
|
- unsigned int dataoff,
|
|
|
|
- enum ip_conntrack_info *ctinfo,
|
|
|
|
- int pf,
|
|
|
|
- unsigned int hooknum)
|
|
|
|
-{
|
|
|
|
- return udp_error(skb, dataoff, ctinfo, pf, hooknum, csum6);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
struct nf_conntrack_protocol nf_conntrack_protocol_udp4 =
|
|
struct nf_conntrack_protocol nf_conntrack_protocol_udp4 =
|
|
{
|
|
{
|
|
.l3proto = PF_INET,
|
|
.l3proto = PF_INET,
|
|
@@ -197,7 +157,7 @@ struct nf_conntrack_protocol nf_conntrack_protocol_udp4 =
|
|
.print_conntrack = udp_print_conntrack,
|
|
.print_conntrack = udp_print_conntrack,
|
|
.packet = udp_packet,
|
|
.packet = udp_packet,
|
|
.new = udp_new,
|
|
.new = udp_new,
|
|
- .error = udp_error4,
|
|
|
|
|
|
+ .error = udp_error,
|
|
#if defined(CONFIG_NF_CT_NETLINK) || \
|
|
#if defined(CONFIG_NF_CT_NETLINK) || \
|
|
defined(CONFIG_NF_CT_NETLINK_MODULE)
|
|
defined(CONFIG_NF_CT_NETLINK_MODULE)
|
|
.tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
|
|
.tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
|
|
@@ -216,7 +176,7 @@ struct nf_conntrack_protocol nf_conntrack_protocol_udp6 =
|
|
.print_conntrack = udp_print_conntrack,
|
|
.print_conntrack = udp_print_conntrack,
|
|
.packet = udp_packet,
|
|
.packet = udp_packet,
|
|
.new = udp_new,
|
|
.new = udp_new,
|
|
- .error = udp_error6,
|
|
|
|
|
|
+ .error = udp_error,
|
|
#if defined(CONFIG_NF_CT_NETLINK) || \
|
|
#if defined(CONFIG_NF_CT_NETLINK) || \
|
|
defined(CONFIG_NF_CT_NETLINK_MODULE)
|
|
defined(CONFIG_NF_CT_NETLINK_MODULE)
|
|
.tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
|
|
.tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
|