- 論壇徽章:
- 0
|
1)隨意看了看iptables的extensions的代碼,看到 libipt_ttl.c 的時(shí)候,發(fā)現(xiàn)這份代碼的一個(gè)問題
我的配置: iptables-1.3.4,已經(jīng)pom和patch了
2)在 1.3.4 版本的 parse 函數(shù)中,竟然把下述代碼放到了 option 解析之后:
if( * flags )
{
exit_error(PARAMETER_PROBLEM, "Can't specify TTL option twice");
}
即原來的代碼是這樣的:
switch( c )
{
....................
}
if( * flags )
{
exit_error(PARAMETER_PROBLEM, "Can't specify TTL option twice");
}
看到之后,感覺這段代碼一定會(huì)導(dǎo)致 Segmentation fault,于是試了一試:
iptables -A INPUT -m ttl --ttl-eq 123 -J DROP
果然,Segmentation fault,注意,這里我使用的是 -J 而不是 -j
3)如何解決:
if( * flags )
{
exit_error(PARAMETER_PROBLEM, "Can't specify TTL option twice");
}
代碼放到 check_inverse(optarg, &invert, &optind, 0); 之前即可,把該檢查的邏輯放到頭里去做
4)也許有別人也遇到這個(gè)問題,希望對(duì)你們有幫助 |
|