我有一個捕獲TCP數據包的Netfilter模塊。Netfilter編輯TCP有效負載時崩潰
然後我訪問數據有效載荷,然後替換一些單詞。但是,它偶爾會出現錯誤,然後掛斷。然後,數據包不能再通過...
只有帶有端口80的TCP數據包纔會通過。
數據由data = (char *)((unsigned char *)tcp_header + (tcp_header->doff * 4));
while(strstr(data, "the") != NULL){
data = replace_str(data, "the", "REDACTED", 0);
//censors the word "the" and replaces with "REDACTED"
}
printk("Port 80 Web Data:\n %s \n",data);
什麼是'replace_str'函數?根據它的名字,它應該將一個字符串替換爲另一個字符串,但是如果替換字符串的長度不同會怎樣? – Tsyvarev