git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ofproto: Fix potential leak during flow mods.
[sliver-openvswitch.git]
/
utilities
/
nlmon.c
diff --git
a/utilities/nlmon.c
b/utilities/nlmon.c
index
1b2f1e2
..
99b060c
100644
(file)
--- a/
utilities/nlmon.c
+++ b/
utilities/nlmon.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2009, 2010, 2011, 2012 Nicira
Networks
.
+ * Copyright (c) 2009, 2010, 2011, 2012 Nicira
, Inc
.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-39,7
+39,9
@@
static const struct nl_policy rtnlgrp_link_policy[] = {
int
main(int argc OVS_UNUSED, char *argv[])
{
int
main(int argc OVS_UNUSED, char *argv[])
{
+ uint64_t buf_stub[4096 / 64];
struct nl_sock *sock;
struct nl_sock *sock;
+ struct ofpbuf buf;
int error;
set_program_name(argv[0]);
int error;
set_program_name(argv[0]);
@@
-55,9
+57,8
@@
main(int argc OVS_UNUSED, char *argv[])
ovs_fatal(error, "could not join RTNLGRP_LINK multicast group");
}
ovs_fatal(error, "could not join RTNLGRP_LINK multicast group");
}
+ ofpbuf_use_stub(&buf, buf_stub, sizeof buf_stub);
for (;;) {
for (;;) {
- struct ofpbuf *buf;
-
error = nl_sock_recv(sock, &buf, false);
if (error == EAGAIN) {
/* Nothing to do. */
error = nl_sock_recv(sock, &buf, false);
if (error == EAGAIN) {
/* Nothing to do. */
@@
-95,19
+96,17
@@
main(int argc OVS_UNUSED, char *argv[])
struct ifinfomsg *iim;
int i;
struct ifinfomsg *iim;
int i;
- nlh = ofpbuf_at(buf, 0, NLMSG_HDRLEN);
- iim = ofpbuf_at(buf, NLMSG_HDRLEN, sizeof *iim);
+ nlh = ofpbuf_at(
&
buf, 0, NLMSG_HDRLEN);
+ iim = ofpbuf_at(
&
buf, NLMSG_HDRLEN, sizeof *iim);
if (!iim) {
ovs_error(0, "received bad rtnl message (no ifinfomsg)");
if (!iim) {
ovs_error(0, "received bad rtnl message (no ifinfomsg)");
- ofpbuf_delete(buf);
continue;
}
continue;
}
- if (!nl_policy_parse(buf, NLMSG_HDRLEN + sizeof(struct ifinfomsg),
+ if (!nl_policy_parse(
&
buf, NLMSG_HDRLEN + sizeof(struct ifinfomsg),
rtnlgrp_link_policy,
attrs, ARRAY_SIZE(rtnlgrp_link_policy))) {
ovs_error(0, "received bad rtnl message (policy)");
rtnlgrp_link_policy,
attrs, ARRAY_SIZE(rtnlgrp_link_policy))) {
ovs_error(0, "received bad rtnl message (policy)");
- ofpbuf_delete(buf);
continue;
}
printf("netdev %s changed (%s):\n",
continue;
}
printf("netdev %s changed (%s):\n",
@@
-132,7
+131,6
@@
main(int argc OVS_UNUSED, char *argv[])
}
printf("\tmaster=%"PRIu32" (%s)\n", idx, ifname);
}
}
printf("\tmaster=%"PRIu32" (%s)\n", idx, ifname);
}
- ofpbuf_delete(buf);
}
nl_sock_wait(sock, POLLIN);
}
nl_sock_wait(sock, POLLIN);