亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2286 | 回復: 2
打印 上一主題 下一主題

內核connlimit模塊問題 [復制鏈接]

論壇徽章:
0
跳轉到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2011-03-03 09:30 |只看該作者 |倒序瀏覽
本帖最后由 zzappled 于 2011-03-03 09:42 編輯

static inline u_int8_t nf_ct_protonum(const struct nf_conn *ct)
{
    return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum;
}

static inline bool already_closed(const struct nf_conn *conn)
{
    if (nf_ct_protonum(conn) == IPPROTO_TCP)
        return conn->proto.tcp.state == TCP_CONNTRACK_TIME_WAIT ||
               conn->proto.tcp.state == TCP_CONNTRACK_CLOSE;
    else
        return 0;
}

list_for_each_entry_safe(conn, tmp, hash, list) {
        found    = nf_conntrack_find_get(&init_net, &conn->tuple);
        found_ct = NULL;

        if (found != NULL)
            found_ct = nf_ct_tuplehash_to_ctrack(found);

        if (found_ct != NULL &&
            nf_ct_tuple_equal(&conn->tuple, tuple) &&
            !already_closed(found_ct))
            /*
                         * Just to be sure we have it only once in the list.
                         * We should not see tuples twice unless someone hooks
                         * this into a table without "-p tcp --syn".
                         */
            addit = false;

        if (found == NULL) {
            /* this one is gone */
            list_del(&conn->list);
            kfree(conn);
            continue;
        }

       if (already_closed(found_ct))//為什么這里不判斷found_ct是否為NULL,是BUG還是別的 {
            /*
                         * we do not care about connections which are
                         * closed already -> ditch it
                         */
            nf_ct_put(found_ct);
            list_del(&conn->list);
            kfree(conn);
            continue;
        }

        if (same_source_net(addr, mask, &conn->tuple.src.u3, family))
            /* same source network -> be counted! */
            ++matches;
        nf_ct_put(found_ct);
    }

論壇徽章:
36
IT運維版塊每日發(fā)帖之星
日期:2016-04-10 06:20:00IT運維版塊每日發(fā)帖之星
日期:2016-04-16 06:20:0015-16賽季CBA聯(lián)賽之廣東
日期:2016-04-16 19:59:32IT運維版塊每日發(fā)帖之星
日期:2016-04-18 06:20:00IT運維版塊每日發(fā)帖之星
日期:2016-04-19 06:20:00每日論壇發(fā)貼之星
日期:2016-04-19 06:20:00IT運維版塊每日發(fā)帖之星
日期:2016-04-25 06:20:00IT運維版塊每日發(fā)帖之星
日期:2016-05-06 06:20:00IT運維版塊每日發(fā)帖之星
日期:2016-05-08 06:20:00IT運維版塊每日發(fā)帖之星
日期:2016-05-13 06:20:00IT運維版塊每日發(fā)帖之星
日期:2016-05-28 06:20:00每日論壇發(fā)貼之星
日期:2016-05-28 06:20:00
2 [報告]
發(fā)表于 2011-03-03 10:48 |只看該作者
回復 1# zzappled

仔細看一下前面的代碼,是不是已經保證了一定不是 NULL 的情況

論壇徽章:
0
3 [報告]
發(fā)表于 2011-03-03 10:59 |只看該作者
list_for_each_entry_safe(conn, tmp, hash, list) {
        found    = nf_conntrack_find_get(&init_net, &conn->tuple);
        found_ct = NULL;

        if (found != NULL)
            found_ct = nf_ct_tuplehash_to_ctrack(found);

        if (found_ct != NULL &&
            nf_ct_tuple_equal(&conn->tuple, tuple) &&
            !already_closed(found_ct))

在鏈表循環(huán)中,found_ct初始為NULL,如果found_ct = nf_ct_tuplehash_to_ctrack(found);始終不為NULL的話倒也好,那么下面if語句又進行了判斷,為什么這句if (already_closed(found_ct))就不判斷了
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術有限公司. 版權所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關心和支持過ChinaUnix的朋友們 轉載本站內容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP