<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>28608</bug_id>
          
          <creation_ts>2013-02-26 22:27:53 +0400</creation_ts>
          <short_desc>efw restart загружает conntrack</short_desc>
          <delta_ts>2013-02-27 13:56:12 +0400</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>etcnet</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Anton Farygin">rider</reporter>
          <assigned_to name="Mikhail Efremov">sem</assigned_to>
          <cc>ldv</cc>
    
    <cc>rider</cc>
    
    <cc>sem</cc>
    
    <cc>shaba</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>138200</commentid>
    <comment_count>0</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2013-02-26 22:27:53 +0400</bug_when>
    <thetext>Сразу после загрузки модулей conntrack нет (так и должно быть).

После efw restart модули появляются. Это плохо на высоконагруженных роутерах - загруженные модули conntrack приводят к тому, что ядро отслеживает все соединения и не создаёт новых при переполнении таблицы conntrack.

и что ещё хуже - увеличение таблицы через sysctl не работает, ибо на момент загрузки системы модулей conntrack в системе нет.

Необходимо сделать так, что бы перезапуск firewall в etcnet не загружал дополнительных модулей ядра, если в этом нет необходимости.

Воспроизводится очень просто на любой системе, не являющейся шлюзом:
[root@riderkvmS ~]# lsmod |grep conn
[root@riderkvmS ~]# efw restart
Interface is &quot;default&quot;
Table is &quot;filter&quot;
Chain is &quot;&quot;
Action is &quot;restart&quot;

Firewall type is &quot;iptables&quot;
Stopping iptables for default
	Flushing the &quot;OUTPUT&quot; chain in the &quot;filter&quot; table
	Flushing the &quot;FORWARD&quot; chain in the &quot;filter&quot; table
	Flushing the &quot;INPUT&quot; chain in the &quot;filter&quot; table
	Flushing the &quot;POSTROUTING&quot; chain in the &quot;nat&quot; table
	Flushing the &quot;OUTPUT&quot; chain in the &quot;nat&quot; table
	Flushing the &quot;PREROUTING&quot; chain in the &quot;nat&quot; table
	Flushing the &quot;POSTROUTING&quot; chain in the &quot;mangle&quot; table
	Flushing the &quot;OUTPUT&quot; chain in the &quot;mangle&quot; table
	Flushing the &quot;FORWARD&quot; chain in the &quot;mangle&quot; table
	Flushing the &quot;INPUT&quot; chain in the &quot;mangle&quot; table
	Flushing the &quot;PREROUTING&quot; chain in the &quot;mangle&quot; table
	Setting ACCEPT policy for the &quot;INPUT&quot; chain in the &quot;filter&quot; table
	Setting ACCEPT policy for the &quot;FORWARD&quot; chain in the &quot;filter&quot; table
	Setting ACCEPT policy for the &quot;OUTPUT&quot; chain in the &quot;filter&quot; table
Starting iptables for default
	Setting ACCEPT policy for the &quot;INPUT&quot; chain in the &quot;filter&quot; table
	Setting ACCEPT policy for the &quot;FORWARD&quot; chain in the &quot;filter&quot; table
	Setting ACCEPT policy for the &quot;OUTPUT&quot; chain in the &quot;filter&quot; table

[root@riderkvmS ~]# lsmod |grep conn
nf_conntrack_ipv4      14110  3 nf_nat,iptable_nat
nf_defrag_ipv4          1537  1 nf_conntrack_ipv4
nf_conntrack           83469  3 nf_nat,iptable_nat,nf_conntrack_ipv4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>138201</commentid>
    <comment_count>1</comment_count>
    <who name="Andrew Kornilov">hiddenman</who>
    <bug_when>2013-02-26 22:45:42 +0400</bug_when>
    <thetext>А это не efw, ответственно заявляю как автор ;-)

Экспериментально выяснил только что следующее:

# lsmod |grep conn
# iptables -F OUTPUT -t nat
# lsmod |grep conn
nf_conntrack_ipv4      10493  3 iptable_nat,nf_nat
nf_conntrack           63523  3 iptable_nat,nf_nat,nf_conntrack_ipv4
nf_defrag_ipv4          1205  1 nf_conntrack_ipv4


Именно после этого flush-а начинается эта проблема. Другие flush-и это не делают. Грузит это всё, похоже, модуль iptables_nat.

Команда modprobe -r iptable_nat  убирает все эти модули.

Можете её выполнял где-то в скриптах любых остановки (даже в конфигах).  Можно еще что-то придумать, но это уже будет костыль, imho.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>138205</commentid>
    <comment_count>2</comment_count>
    <who name="Sergey Bolshakov">sbolshakov</who>
    <bug_when>2013-02-27 00:31:58 +0400</bug_when>
    <thetext>если нужно держать в рамках размер conntrack&apos;а -- есть таблица raw и джамп NOTRACK. файрвол же вообще без conntrack -- это как-то хм.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>138209</commentid>
    <comment_count>3</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2013-02-27 10:03:32 +0400</bug_when>
    <thetext>А зачем на файрволле conntrack, объясни пожалуйста ?

Файрволл - это же не всегда NAT, верно ?
Таблица raw - ещё один костыль.
Давайте сделаем хотя-бы так, что если в таблице nat пусто - то и не делаем её -F</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>138210</commentid>
    <comment_count>4</comment_count>
    <who name="Andrew Kornilov">hiddenman</who>
    <bug_when>2013-02-27 12:57:41 +0400</bug_when>
    <thetext>А как мы узнаем, пустая она или нет? Встраивать ненужный интеллект в скрипты? 

Проще, мне кажется, в blacklist запихнуть эти модули, чтобы не грузились. Ну или выяснить, почему iptables их вообще грузит для этого.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>138212</commentid>
    <comment_count>5</comment_count>
    <who name="Sergey Bolshakov">sbolshakov</who>
    <bug_when>2013-02-27 13:56:12 +0400</bug_when>
    <thetext>(In reply to comment #3)
&gt; А зачем на файрволле conntrack, объясни пожалуйста ?
&gt; 
&gt; Файрволл - это же не всегда NAT, верно ?

Для RELATED. Вообще, этот наш линупс со времён 2.2 имеет
stateful firewall, и conntrack -- это вот оно и есть.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>