Commit 069fa23e authored by Patrick McHardy's avatar Patrick McHardy

[NETFILTER]: Handle nonlinear skbs in ip_queue/ip6_queue

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent 2d2ddfcd
...@@ -257,7 +257,8 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) ...@@ -257,7 +257,8 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
} }
if (data_len) if (data_len)
memcpy(pmsg->payload, entry->skb->data, data_len); if (skb_copy_bits(entry->skb, 0, pmsg->payload, data_len))
BUG();
nlh->nlmsg_len = skb->tail - old_tail; nlh->nlmsg_len = skb->tail - old_tail;
return skb; return skb;
...@@ -362,6 +363,8 @@ ipq_mangle_ipv4(ipq_verdict_msg_t *v, struct ipq_queue_entry *e) ...@@ -362,6 +363,8 @@ ipq_mangle_ipv4(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
} }
skb_put(e->skb, diff); skb_put(e->skb, diff);
} }
if (!skb_ip_make_writable(&e->skb, v->data_len))
return -ENOMEM;
memcpy(e->skb->data, v->payload, v->data_len); memcpy(e->skb->data, v->payload, v->data_len);
e->skb->nfcache |= NFC_ALTERED; e->skb->nfcache |= NFC_ALTERED;
......
...@@ -262,7 +262,8 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) ...@@ -262,7 +262,8 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
} }
if (data_len) if (data_len)
memcpy(pmsg->payload, entry->skb->data, data_len); if (skb_copy_bits(entry->skb, 0, pmsg->payload, data_len))
BUG();
nlh->nlmsg_len = skb->tail - old_tail; nlh->nlmsg_len = skb->tail - old_tail;
return skb; return skb;
...@@ -366,6 +367,8 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e) ...@@ -366,6 +367,8 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
} }
skb_put(e->skb, diff); skb_put(e->skb, diff);
} }
if (!skb_ip_make_writable(&e->skb, v->data_len))
return -ENOMEM;
memcpy(e->skb->data, v->payload, v->data_len); memcpy(e->skb->data, v->payload, v->data_len);
e->skb->nfcache |= NFC_ALTERED; e->skb->nfcache |= NFC_ALTERED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment