提交 a718eb19 编写于 作者: S Stefan Berger 提交者: Stefan Berger

nwfilter: Cap the poll timeout in the DHCP Snooping code

Cap the poll timeout in the DHCP Snooping code to a max. of 10 seconds
to not hold up the libvirt shutdown longer than this.
Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
上级 2ebf593a
...@@ -265,6 +265,7 @@ struct _virNWFilterSnoopRateLimitConf { ...@@ -265,6 +265,7 @@ struct _virNWFilterSnoopRateLimitConf {
const unsigned int burstRate; const unsigned int burstRate;
const unsigned int burstInterval; const unsigned int burstInterval;
}; };
#define SNOOP_POLL_MAX_TIMEOUT_MS (10 * 1000) /* milliseconds */
typedef struct _virNWFilterSnoopPcapConf virNWFilterSnoopPcapConf; typedef struct _virNWFilterSnoopPcapConf virNWFilterSnoopPcapConf;
typedef virNWFilterSnoopPcapConf *virNWFilterSnoopPcapConfPtr; typedef virNWFilterSnoopPcapConf *virNWFilterSnoopPcapConfPtr;
...@@ -1419,6 +1420,10 @@ virNWFilterDHCPSnoopThread(void *req0) ...@@ -1419,6 +1420,10 @@ virNWFilterDHCPSnoopThread(void *req0)
break; break;
} }
/* cap pollTo so we don't hold up the join for too long */
if (pollTo < 0 || pollTo > SNOOP_POLL_MAX_TIMEOUT_MS)
pollTo = SNOOP_POLL_MAX_TIMEOUT_MS;
n = poll(fds, ARRAY_CARDINALITY(fds), pollTo); n = poll(fds, ARRAY_CARDINALITY(fds), pollTo);
if (n < 0) { if (n < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册