mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 23:05:29 +00:00
Fix non-static instances of "struct vlog_rate_limit" and add check.
A non-static vlog_rate_limit is not actually going to rate-limit anything.
This commit is contained in:
11
Makefile.am
11
Makefile.am
@@ -124,6 +124,17 @@ distfiles: Makefile
|
|||||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | sort -u > $@
|
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | sort -u > $@
|
||||||
CLEANFILES += distfiles
|
CLEANFILES += distfiles
|
||||||
|
|
||||||
|
# Check that "struct vlog_ratelimit" is always declared "static".
|
||||||
|
ALL_LOCAL += rate-limit-check
|
||||||
|
rate-limit-check:
|
||||||
|
@if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
|
||||||
|
git --no-pager grep -n -E '^[ ]+struct vlog_rate_limit.*=' $(srcdir); \
|
||||||
|
then \
|
||||||
|
echo "See above for list of violations of the rule that "; \
|
||||||
|
echo "'struct vlog_rate_limit' must always be 'static'"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
dist-hook: $(DIST_HOOKS)
|
dist-hook: $(DIST_HOOKS)
|
||||||
all-local: $(ALL_LOCAL)
|
all-local: $(ALL_LOCAL)
|
||||||
clean-local: $(CLEAN_LOCAL)
|
clean-local: $(CLEAN_LOCAL)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, 2010 Nicira Networks.
|
* Copyright (c) 2009, 2010, 2011 Nicira Networks.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -966,7 +966,7 @@ dp_netdev_run(void)
|
|||||||
if (!error) {
|
if (!error) {
|
||||||
dp_netdev_port_input(dp, port, &packet);
|
dp_netdev_port_input(dp, port, &packet);
|
||||||
} else if (error != EAGAIN && error != EOPNOTSUPP) {
|
} else if (error != EAGAIN && error != EOPNOTSUPP) {
|
||||||
struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
|
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
|
||||||
VLOG_ERR_RL(&rl, "error receiving data from %s: %s",
|
VLOG_ERR_RL(&rl, "error receiving data from %s: %s",
|
||||||
netdev_get_name(port->netdev), strerror(error));
|
netdev_get_name(port->netdev), strerror(error));
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2009, 2010 Nicira Networks.
|
* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -114,7 +114,7 @@ int
|
|||||||
lookup_ip(const char *host_name, struct in_addr *addr)
|
lookup_ip(const char *host_name, struct in_addr *addr)
|
||||||
{
|
{
|
||||||
if (!inet_aton(host_name, addr)) {
|
if (!inet_aton(host_name, addr)) {
|
||||||
struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
|
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
|
||||||
VLOG_ERR_RL(&rl, "\"%s\" is not a valid IP address", host_name);
|
VLOG_ERR_RL(&rl, "\"%s\" is not a valid IP address", host_name);
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ get_socket_error(int fd)
|
|||||||
int error;
|
int error;
|
||||||
socklen_t len = sizeof(error);
|
socklen_t len = sizeof(error);
|
||||||
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
|
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
|
||||||
struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 10);
|
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 10);
|
||||||
error = errno;
|
error = errno;
|
||||||
VLOG_ERR_RL(&rl, "getsockopt(SO_ERROR): %s", strerror(error));
|
VLOG_ERR_RL(&rl, "getsockopt(SO_ERROR): %s", strerror(error));
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, 2010 Nicira Networks.
|
* Copyright (c) 2009, 2010, 2011 Nicira Networks.
|
||||||
* Copyright (c) 2010 Jean Tourrilhes - HP-Labs.
|
* Copyright (c) 2010 Jean Tourrilhes - HP-Labs.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@@ -2681,7 +2681,7 @@ xlate_table_action(struct action_xlate_ctx *ctx, uint16_t in_port)
|
|||||||
ctx->recurse--;
|
ctx->recurse--;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct vlog_rate_limit recurse_rl = VLOG_RATE_LIMIT_INIT(1, 1);
|
static struct vlog_rate_limit recurse_rl = VLOG_RATE_LIMIT_INIT(1, 1);
|
||||||
|
|
||||||
VLOG_ERR_RL(&recurse_rl, "NXAST_RESUBMIT recursed over %d times",
|
VLOG_ERR_RL(&recurse_rl, "NXAST_RESUBMIT recursed over %d times",
|
||||||
MAX_RESUBMIT_RECURSION);
|
MAX_RESUBMIT_RECURSION);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008, 2009, 2010 Nicira Networks
|
/* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -917,7 +917,7 @@ handle_fdb_query_cmd(const struct ovsrec_open_vswitch *ovs,
|
|||||||
if (sscanf(line, "%d %d "ETH_ADDR_SCAN_FMT" %d",
|
if (sscanf(line, "%d %d "ETH_ADDR_SCAN_FMT" %d",
|
||||||
&port, &vlan, ETH_ADDR_SCAN_ARGS(mac), &age)
|
&port, &vlan, ETH_ADDR_SCAN_ARGS(mac), &age)
|
||||||
!= 2 + ETH_ADDR_SCAN_COUNT + 1) {
|
!= 2 + ETH_ADDR_SCAN_COUNT + 1) {
|
||||||
struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
|
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
|
||||||
VLOG_INFO_RL(&rl, "fdb/show output has invalid format: %s", line);
|
VLOG_INFO_RL(&rl, "fdb/show output has invalid format: %s", line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user