免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: sisi8408
打印 上一主题 下一主题

派对 [复制链接]

论坛徽章:
0
31 [报告]
发表于 2007-01-31 16:54 |只看该作者
我也找到一个,也许有帮助
http://bbs.sjtu.edu.cn/bbscon,board,Embedded,file,M.1144114262.A.html

论坛徽章:
0
32 [报告]
发表于 2007-01-31 16:57 |只看该作者
3x u alot, platinum~~~~~~~~~

论坛徽章:
0
33 [报告]
发表于 2007-02-01 10:55 |只看该作者

  1. struct ip_conntrack_tuple_hash *       
  2. __ip_conntrack_find(const struct ip_conntrack_tuple *tuple,
  3.                     const struct ip_conntrack *ignored_conntrack)
  4. {
  5.         struct ip_conntrack_tuple_hash * h;
  6.         unsigned int hash = hash_conntrack(tuple);

  7.         ASSERT_READ_LOCK(&ip_conntrack_lock);
  8.        
  9.         list_for_each_entry(h, &ip_conntrack_hash[hash], list) {
  10.                 if (conntrack_tuple_cmp(h, tuple, ignored_conntrack)) {
  11.                         CONNTRACK_STAT_INC(found);
  12.                         /*
  13.                          * put h at head for #####
  14.                          * clean early_drop machine.
  15.                          */
  16.                         return h;
  17.                 }
  18.                 CONNTRACK_STAT_INC(searched);
  19.         }

  20.         return NULL;
  21. }
复制代码

论坛徽章:
0
34 [报告]
发表于 2007-02-01 11:24 |只看该作者

  1. struct ip_conntrack *       
  2. ip_conntrack_alloc(struct ip_conntrack_tuple *orig,
  3.                 struct ip_conntrack_tuple *repl)
  4. {
  5.         struct ip_conntrack *conntrack;

  6.         if (!ip_conntrack_hash_rnd_initted) {
  7.                 get_random_bytes(&ip_conntrack_hash_rnd, 4);
  8.                 ip_conntrack_hash_rnd_initted = 1;
  9.         }

  10.         if (ip_conntrack_max &&
  11.             atomic_read(&ip_conntrack_count) >= ip_conntrack_max) {
  12.                 unsigned int hash = hash_conntrack(orig);
  13.                 /*
  14.                  * Try dropping from this hash chain,
  15.                  * but too late for DOS #####
  16.                  */
  17.                 if (!early_drop(&ip_conntrack_hash[hash])) {
  18.                         if (net_ratelimit())
  19.                                 printk(KERN_WARNING "ip_conntrack: table full, dropping packet.\n");
  20.                         return ERR_PTR(-ENOMEM);
  21.                 }
  22.         }
  23. ............
  24. }
复制代码

论坛徽章:
0
35 [报告]
发表于 2007-02-01 13:49 |只看该作者
话说各位是否知道目前哪个tcp/ip协议栈实现性能突出且能较好的利用MP工作的?

论坛徽章:
0
36 [报告]
发表于 2007-02-01 14:14 |只看该作者

  1. unsigned int ip_conntrack_in(....)
  2. {
  3. .......
  4.         ct = resolve_normal_ct(*pskb, proto, &set_reply, hooknum, &ctinfo);

  5.         if (!ct) {                /* Not valid part of a connection */
  6.                 CONNTRACK_STAT_INC(invalid);
  7.                 return NF_ACCEPT;               
  8.                 /* the so-called no match then pass, #####
  9.                  * if iph->protocol not recognised??
  10.                  */
  11.         }
  12. .......
  13. }
复制代码


均是 linux-2.6.18.3, 如无说明。

[ 本帖最后由 sisi8408 于 2007-2-1 14:16 编辑 ]

论坛徽章:
0
37 [报告]
发表于 2007-02-01 14:44 |只看该作者

  1. int ip_conntrack_expect_related(struct ip_conntrack_expect *expect)
  2. {
  3. .......
  4.         /* Will be over limit? */
  5.         if (expect->master->helper->max_expected &&
  6.             expect->master->expecting >= expect->master->helper->max_expected) {
  7.                 evict_oldest_expect(expect->master);
  8.                 /*
  9.                  * in rare cases, no expect evicted,
  10.                  * so still overlimit #######
  11.                  */
  12.         }
  13.         ip_conntrack_expect_insert(expect);

  14. .......
  15. }
复制代码

论坛徽章:
0
38 [报告]
发表于 2007-02-02 10:40 |只看该作者

  1. /* ip_conntrack_proto_tcp.c */

  2. static void tcp_options(const struct sk_buff *skb,
  3.                         struct iphdr *iph,
  4.                         struct tcphdr *tcph,
  5.                         struct ip_ct_tcp_state *state)
  6. {
  7. ......
  8.                 default:
  9.                         opsize = *ptr++;
  10.                         if (opsize < 2) /* "silly options" */
  11.                                 return;
  12.                         // 1, thses 2 if not warrant the integrity
  13.                         // of state in case of nicely constructed syn,
  14.                         // though only sack and winscale concerned here.
  15.                         // #####
  16.                         // 2, possible for linux to do syn proxy as BSD,
  17.                         // though timestamp also not concerned????
  18.                         // 3, if tcp options not concerned, how to
  19.                         // warrant tcp quality??
  20.                         if (opsize > length)
  21.                                 break;        /* don't parse partial options */

  22. ......
  23. }
复制代码

论坛徽章:
0
39 [报告]
发表于 2007-02-02 14:16 |只看该作者

  1. /* ip_conntrack_proto_tcp.c */

  2. static int tcp_new(struct ip_conntrack *conntrack,
  3.                    const struct sk_buff *skb)
  4. {
  5. ......
  6.         if (new_state == TCP_CONNTRACK_SYN_SENT) {
  7.                 /* SYN packet */
  8.                 conntrack->proto.tcp.seen[0].td_end = /* ct is fooled by big syn ##### */
  9.                 segment_seq_plus_len(ntohl(th->seq), skb->len, iph, th);
  10. ......
  11. }
复制代码


请 jack 看仔细

[ 本帖最后由 sisi8408 于 2007-2-2 14:24 编辑 ]

论坛徽章:
0
40 [报告]
发表于 2007-02-02 15:13 |只看该作者

  1. struct ip_nat_protocol * ip_nat_proto_find_get(u_int8_t protonum)
  2. {
  3.         struct ip_nat_protocol * p;

  4.         /* we need to disable preemption to make sure 'p' doesn't get
  5.          * removed until we've grabbed the reference
  6.          */
  7.         preempt_disable();
  8.         p = __ip_nat_proto_find(protonum);
  9.         if (/* p && not regulor enough ##### */
  10.             !try_module_get(p->me))
  11.                 p = &ip_nat_unknown_protocol;
  12.         preempt_enable();

  13.         return p;
  14. }
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP