# Заморочки с iptables

## Corsar

Свежепоставленная система.

2.6.31-gentoo-r6 x86_64

iptables-1.4.3.2

2 заморочки:

- iptables -p INPUT DROP дает ошибку сегментирования. Пока вышел из положения последним правилом: -j DROP

- iptables-save при сохранении правил с русскими комментариями убирает кавычки, соответственно в следующий раз хрен че стартует

Че делать, куда смотреть?

Может флаги в make.conf как-то криво выставил?

CFLAGS="-march=nocona -O2 -pipe -fomit-frame-pointer"

----------

## fank

```
emerge strace
```

----------

## Corsar

Запустил strace iptables -P INPUT -j ACCEPT

```

execve("/sbin/iptables", ["iptables", "-p", "INPUT", "-j", "ACCEPT"], [/* 21 vars */]) = 0

brk(0)                                  = 0xd95000

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb218600000

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb2185ff000

access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)

open("/etc/ld.so.cache", O_RDONLY)      = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=20213, ...}) = 0

mmap(NULL, 20213, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb2185fa000

close(3)                                = 0

open("/usr/lib/libiptc.so.0", O_RDONLY) = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000)\0\0\0\0\0\0"..., 832) = 832

fstat(3, {st_mode=S_IFREG|0755, st_size=47168, ...}) = 0

mmap(NULL, 2142496, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb2181d9000

mprotect(0x7fb2181e3000, 2097152, PROT_NONE) = 0

mmap(0x7fb2183e3000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7fb2183e3000

close(3)                                = 0

open("/usr/lib/libxtables.so.2", O_RDONLY) = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340'\0\0\0\0\0\0"..., 832) = 832

fstat(3, {st_mode=S_IFREG|0755, st_size=27032, ...}) = 0

mmap(NULL, 2123744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb217fd2000

mprotect(0x7fb217fd8000, 2093056, PROT_NONE) = 0

mmap(0x7fb2181d7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5000) = 0x7fb2181d7000

close(3)                                = 0

open("/lib/libm.so.6", O_RDONLY)        = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200>\0\0\0\0\0\0"..., 832) = 832

fstat(3, {st_mode=S_IFREG|0755, st_size=534648, ...}) = 0

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb2185f9000

mmap(NULL, 2629848, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb217d4f000

mprotect(0x7fb217dd1000, 2093056, PROT_NONE) = 0

mmap(0x7fb217fd0000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x81000) = 0x7fb217fd0000

close(3)                                = 0

open("/lib/libc.so.6", O_RDONLY)        = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\353\1\0\0\0\0\0"..., 832) = 832

fstat(3, {st_mode=S_IFREG|0755, st_size=1399984, ...}) = 0

mmap(NULL, 3508264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb2179f6000

mprotect(0x7fb217b45000, 2097152, PROT_NONE) = 0

mmap(0x7fb217d45000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14f000) = 0x7fb217d45000

mmap(0x7fb217d4a000, 18472, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb217d4a000

close(3)                                = 0

open("/lib/libdl.so.2", O_RDONLY)       = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\r\0\0\0\0\0\0"..., 832) = 832

fstat(3, {st_mode=S_IFREG|0755, st_size=14512, ...}) = 0

mmap(NULL, 2109696, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb2177f2000

mprotect(0x7fb2177f4000, 2097152, PROT_NONE) = 0

mmap(0x7fb2179f4000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fb2179f4000

close(3)                                = 0

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb2185f8000

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb2185f7000

arch_prctl(ARCH_SET_FS, 0x7fb2185f76f0) = 0

mprotect(0x7fb2179f4000, 4096, PROT_READ) = 0

mprotect(0x7fb217d45000, 16384, PROT_READ) = 0

mprotect(0x7fb217fd0000, 4096, PROT_READ) = 0

mprotect(0x7fb2181d7000, 4096, PROT_READ) = 0

mprotect(0x7fb2183e3000, 4096, PROT_READ) = 0

mprotect(0x608000, 4096, PROT_READ)     = 0

mprotect(0x7fb218601000, 4096, PROT_READ) = 0

munmap(0x7fb2185fa000, 20213)           = 0

brk(0)                                  = 0xd95000

brk(0xdb6000)                           = 0xdb6000

open("/etc/nsswitch.conf", O_RDONLY)    = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=508, ...}) = 0

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb2185fe000

read(3, "# /etc/nsswitch.conf:\n# $Header:"..., 4096) = 508

read(3, "", 4096)                       = 0

close(3)                                = 0

munmap(0x7fb2185fe000, 4096)            = 0

open("/etc/ld.so.cache", O_RDONLY)      = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=20213, ...}) = 0

mmap(NULL, 20213, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb2185fa000

close(3)                                = 0

open("/lib64/tls/x86_64/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)

stat("/lib64/tls/x86_64", 0x7fff4068d4f0) = -1 ENOENT (No such file or directory)

open("/lib64/tls/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)

stat("/lib64/tls", 0x7fff4068d4f0)      = -1 ENOENT (No such file or directory)

open("/lib64/x86_64/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)

stat("/lib64/x86_64", 0x7fff4068d4f0)   = -1 ENOENT (No such file or directory)

open("/lib64/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)

stat("/lib64", {st_mode=S_IFDIR|0755, st_size=3664, ...}) = 0

open("/usr/lib64/tls/x86_64/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)

stat("/usr/lib64/tls/x86_64", 0x7fff4068d4f0) = -1 ENOENT (No such file or directory)

open("/usr/lib64/tls/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)

stat("/usr/lib64/tls", 0x7fff4068d4f0)  = -1 ENOENT (No such file or directory)

open("/usr/lib64/x86_64/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)

stat("/usr/lib64/x86_64", 0x7fff4068d4f0) = -1 ENOENT (No such file or directory)

open("/usr/lib64/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)

stat("/usr/lib64", {st_mode=S_IFDIR|0755, st_size=13096, ...}) = 0

munmap(0x7fb2185fa000, 20213)           = 0

open("/etc/ld.so.cache", O_RDONLY)      = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=20213, ...}) = 0

mmap(NULL, 20213, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb2185fa000

close(3)                                = 0

open("/lib/libnss_files.so.2", O_RDONLY) = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p!\0\0\0\0\0\0"..., 832) = 832

fstat(3, {st_mode=S_IFREG|0755, st_size=47432, ...}) = 0

mmap(NULL, 2143632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb2175e6000

mprotect(0x7fb2175f1000, 2093056, PROT_NONE) = 0

mmap(0x7fb2177f0000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7fb2177f0000

close(3)                                = 0

mprotect(0x7fb2177f0000, 4096, PROT_READ) = 0

munmap(0x7fb2185fa000, 20213)           = 0

open("/etc/protocols", O_RDONLY|O_CLOEXEC) = 3

fcntl(3, F_GETFD)                       = 0x1 (flags FD_CLOEXEC)

fstat(3, {st_mode=S_IFREG|0644, st_size=5681, ...}) = 0

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb2185fe000

read(3, "# /etc/protocols\n#\n# Internet (I"..., 4096) = 4096

read(3, "orking Control Pro.\nscc-sp\t96\tSC"..., 4096) = 1585

read(3, "", 4096)                       = 0

close(3)                                = 0

munmap(0x7fb2185fe000, 4096)            = 0

--- SIGSEGV (Segmentation fault) @ 0 (0) ---

+++ killed by SIGSEGV +++

Ошибка сегментирования

```

----------

