1 #define KMSG_COMPONENT "IPVS"
2 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
4 #include <linux/module.h>
5 #include <linux/kernel.h>
11 #ifdef CONFIG_IP_VS_DEBUG
12 static const char *ip_vs_dbg_callid(
char *
buf,
size_t buf_len,
13 const char *callid,
size_t callid_len,
16 size_t len =
min(
min(callid_len, (
size_t)64), buf_len - *idx - 1);
17 memcpy(buf + *idx, callid, len);
20 return buf + *idx - len;
23 #define IP_VS_DEBUG_CALLID(callid, len) \
24 ip_vs_dbg_callid(ip_vs_dbg_buf, sizeof(ip_vs_dbg_buf), \
25 callid, len, &ip_vs_dbg_idx)
28 static int get_callid(
const char *dptr,
unsigned int dataoff,
30 unsigned int *matchoff,
unsigned int *matchlen)
35 SIP_HDR_CALL_ID, matchoff,
53 if (*matchoff + *matchlen == datalen)
58 if (*(dptr + *matchoff + *matchlen) !=
'\r' &&
59 *(dptr + *matchoff + *matchlen) !=
'\n')
63 IP_VS_DEBUG_CALLID(dptr + *matchoff, *matchlen),
72 unsigned int dataoff,
datalen, matchoff, matchlen;
76 ip_vs_fill_iphdr(p->
af, skb_network_header(skb), &iph);
83 dataoff = iph.len +
sizeof(
struct udphdr);
84 if (dataoff >= skb->
len)
87 if ((retc=skb_linearize(skb)) < 0)
89 dptr = skb->
data + dataoff;
90 datalen = skb->
len - dataoff;
92 if (get_callid(dptr, dataoff, datalen, &matchoff, &matchlen))
113 if (ct->
af == p->
af &&
130 ret ?
"hit" :
"not hit");
136 u32 initval,
bool inverse)
141 static int ip_vs_sip_show_pe_data(
const struct ip_vs_conn *
cp,
char *
buf)
147 static struct ip_vs_pe ip_vs_sip_pe =
153 .fill_param = ip_vs_sip_fill_param,
154 .ct_match = ip_vs_sip_ct_match,
155 .hashkey_raw = ip_vs_sip_hashkey_raw,
156 .show_pe_data = ip_vs_sip_show_pe_data,
159 static int __init ip_vs_sip_init(
void)
164 static void __exit ip_vs_sip_cleanup(
void)