diff --git a/cfgmgr/natmgrd.cpp b/cfgmgr/natmgrd.cpp index 41009bcebe76..db5a77f9a619 100644 --- a/cfgmgr/natmgrd.cpp +++ b/cfgmgr/natmgrd.cpp @@ -72,6 +72,10 @@ void sigterm_handler(int signo) { SWSS_LOG_ENTER(); + if (old_sigaction.sa_handler != SIG_IGN && old_sigaction.sa_handler != SIG_DFL) { + old_sigaction.sa_handler(signo); + } + gExit = 1; } @@ -109,10 +113,6 @@ void cleanup() natmgr->cleanupMangleIpTables(); natmgr->cleanupPoolIpTable(); } - - if (old_sigaction.sa_handler != SIG_IGN && old_sigaction.sa_handler != SIG_DFL) { - old_sigaction.sa_handler(signo); - } } int main(int argc, char **argv)