Commit 5e26b1b3 authored by Alex Gartrell's avatar Alex Gartrell Committed by Simon Horman
Browse files

ipvs: support scheduling inverse and icmp SCTP packets



In the event of an icmp packet, take only the ports instead of trying to
grab the full header.

In the event of an inverse packet, use the source address and port.
Signed-off-by: default avatarAlex Gartrell <agartrell@fb.com>
Acked-by: default avatarJulian Anastasov <ja@ssi.bg>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
parent 2b0f39ef
...@@ -18,22 +18,24 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, ...@@ -18,22 +18,24 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
struct netns_ipvs *ipvs; struct netns_ipvs *ipvs;
sctp_chunkhdr_t _schunkh, *sch; sctp_chunkhdr_t _schunkh, *sch;
sctp_sctphdr_t *sh, _sctph; sctp_sctphdr_t *sh, _sctph;
__be16 _ports[2], *ports = NULL;
if (ip_vs_iph_icmp(iph)) {
/* TEMPORARY - do not schedule icmp yet */ if (likely(!ip_vs_iph_icmp(iph))) {
*verdict = NF_ACCEPT; sh = skb_header_pointer(skb, iph->len, sizeof(_sctph), &_sctph);
return 0; if (sh) {
} sch = skb_header_pointer(
skb, iph->len + sizeof(sctp_sctphdr_t),
sh = skb_header_pointer(skb, iph->len, sizeof(_sctph), &_sctph); sizeof(_schunkh), &_schunkh);
if (sh == NULL) { if (sch && (sch->type == SCTP_CID_INIT ||
*verdict = NF_DROP; sysctl_sloppy_sctp(ipvs)))
return 0; ports = &sh->source;
}
} else {
ports = skb_header_pointer(
skb, iph->len, sizeof(_ports), &_ports);
} }
sch = skb_header_pointer(skb, iph->len + sizeof(sctp_sctphdr_t), if (!ports) {
sizeof(_schunkh), &_schunkh);
if (sch == NULL) {
*verdict = NF_DROP; *verdict = NF_DROP;
return 0; return 0;
} }
...@@ -41,9 +43,13 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, ...@@ -41,9 +43,13 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
net = skb_net(skb); net = skb_net(skb);
ipvs = net_ipvs(net); ipvs = net_ipvs(net);
rcu_read_lock(); rcu_read_lock();
if ((sch->type == SCTP_CID_INIT || sysctl_sloppy_sctp(ipvs)) && if (likely(!ip_vs_iph_inverse(iph)))
(svc = ip_vs_service_find(net, af, skb->mark, iph->protocol, svc = ip_vs_service_find(net, af, skb->mark, iph->protocol,
&iph->daddr, sh->dest))) { &iph->daddr, ports[1]);
else
svc = ip_vs_service_find(net, af, skb->mark, iph->protocol,
&iph->saddr, ports[0]);
if (svc) {
int ignored; int ignored;
if (ip_vs_todrop(ipvs)) { if (ip_vs_todrop(ipvs)) {
......
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