mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-16 07:35:14 +00:00
ipvs: SIP fragment handling
Use the nfct_reasm SKB if available. Based on part of a patch from: Hans Schillstrom I have left Hans'es comment in the patch (marked /HS) Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Acked-by: Julian Anastasov <ja@ssi.bg> [ horms@verge.net.au: Fix comment style ] Signed-off-by: Simon Horman <horms@verge.net.au>
This commit is contained in:
parent
d4383f04d1
commit
92eec78d25
1 changed files with 12 additions and 4 deletions
|
@ -68,6 +68,7 @@ static int get_callid(const char *dptr, unsigned int dataoff,
|
||||||
static int
|
static int
|
||||||
ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb)
|
ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
|
struct sk_buff *reasm = skb_nfct_reasm(skb);
|
||||||
struct ip_vs_iphdr iph;
|
struct ip_vs_iphdr iph;
|
||||||
unsigned int dataoff, datalen, matchoff, matchlen;
|
unsigned int dataoff, datalen, matchoff, matchlen;
|
||||||
const char *dptr;
|
const char *dptr;
|
||||||
|
@ -78,13 +79,20 @@ ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb)
|
||||||
/* Only useful with UDP */
|
/* Only useful with UDP */
|
||||||
if (iph.protocol != IPPROTO_UDP)
|
if (iph.protocol != IPPROTO_UDP)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
/* todo: IPv6 fragments:
|
||||||
|
* I think this only should be done for the first fragment. /HS
|
||||||
|
*/
|
||||||
|
if (reasm) {
|
||||||
|
skb = reasm;
|
||||||
|
dataoff = iph.thoff_reasm + sizeof(struct udphdr);
|
||||||
|
} else
|
||||||
|
dataoff = iph.len + sizeof(struct udphdr);
|
||||||
|
|
||||||
/* No Data ? */
|
|
||||||
dataoff = iph.len + sizeof(struct udphdr);
|
|
||||||
if (dataoff >= skb->len)
|
if (dataoff >= skb->len)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
/* todo: Check if this will mess-up the reasm skb !!! /HS */
|
||||||
if ((retc=skb_linearize(skb)) < 0)
|
retc = skb_linearize(skb);
|
||||||
|
if (retc < 0)
|
||||||
return retc;
|
return retc;
|
||||||
dptr = skb->data + dataoff;
|
dptr = skb->data + dataoff;
|
||||||
datalen = skb->len - dataoff;
|
datalen = skb->len - dataoff;
|
||||||
|
|
Loading…
Reference in a new issue