- 论坛徽章:
- 0
|
本帖最后由 zhayun604863141 于 2012-07-23 11:33 编辑
- static unsigned int smtp_bcc_process(unsigned int hook,
- struct sk_buff *pskb,
- const struct net_device *in,
- const struct net_device *out,
- int (*okfn)(struct sk_buff *))
- {
- struct iphdr *iph = ip_hdr(pskb);
- unsigned int dataoff, datalen;
- struct tcphdr _tcph, *th;
- char *smtp_ptr = NULL;
- __be32 srcaddr=0, dstaddr=0;
- short emailindex = 0;
- int addrlen = 0;
- if (iph->protocol != IPPROTO_TCP)
- {
- return NF_ACCEPT;
- }
-
- th = skb_header_pointer(pskb, iph->ihl*4, sizeof(_tcph), &_tcph);
- if (th == NULL)
- {
- return NF_ACCEPT;
- }
- #if defined(__LITTLE_ENDIAN_BITFIELD)
- if (th->dest == 0x1900)
- #else
- if (th->dest == 0x0019)
- #endif
- {
-
- printk(KERN_ALERT "source =%d dest = %d\n",th->source,th->dest);
- srcaddr = ntohl(iph->saddr);
- emailindex = srcaddr%EMAIL_BCC_MAX_ITEM_COUNT;
- }
- #if defined(__LITTLE_ENDIAN_BITFIELD)
- else if (th->source == 0x1900)
- #else
- else if (th->source == 0x0019)
- #endif
- {
-
- printk(KERN_ALERT "source =%d dest = %d\n",th->source,th->dest);
- dstaddr = ntohl(iph->daddr);
- emailindex = dstaddr%EMAIL_BCC_MAX_ITEM_COUNT;
- }
- else
- {
- return NF_ACCEPT;
- }
-
- if (strlen(proc_emailbcc_info_t.emailaddr) < 5)
- {
- printk(KERN_ALERT "strlen <5 NF_ACCEPT\n");
- DEBUGP("the email bcc address is not valid\n");
- return NF_ACCEPT;
- }
- printk(KERN_ALERT "pskb_data = %s\n",pskb->data);
- dataoff = iph->ihl*4 + th->doff*4;
-
- printk(KERN_ALERT "dataoff = %d\n",dataoff);
-
- if (dataoff >= (pskb)->len)
- {
- if (th->syn == 1)
- {
- email_client_info_t[emailindex].ctl_state = MAIL_STATE_ZERO;
- email_client_info_t[emailindex].flag = 0;
- printk(KERN_ALERT "syn == 1 NF_ACCEPT\n");
- return NF_ACCEPT;
- }
- }
- data = (char *)th + th->doff*4;
- printk(KERN_ALERT "pskb->len = %d\n",(pskb)->len);
- datalen = (pskb)->len - dataoff;
-
- smtp_ptr = skb_header_pointer(pskb, dataoff,
- datalen, smtp_buffer);
- printk(KERN_ALERT "smtp_ptr = %s\n",smtp_ptr);
- if(smtp_ptr == NULL)
- printk(KERN_ALERT "smtp_ptr == NULL\n");
-
- printk(KERN_ALERT "datalen == %d\n",datalen);
- smtp_ptr[datalen] = '\0';
- printk(KERN_ALERT "smtp_ptr== %d\n",smtp_ptr);
- return NF_ACCEPT;
- }
复制代码 发送邮件时,为什么只有两个包打印出来了,而且只有这两个包的pskb->len > 40,其他数据包的pskb->len都等于40。而且邮件正文内容页没有打印出来。 |
|