Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
devices: fix coverity warning/don't leak fd
[vpp.git]
/
src
/
vnet
/
devices
/
af_packet
/
device.c
diff --git
a/src/vnet/devices/af_packet/device.c
b/src/vnet/devices/af_packet/device.c
index
8e4bc2b
..
c8e59c3
100644
(file)
--- a/
src/vnet/devices/af_packet/device.c
+++ b/
src/vnet/devices/af_packet/device.c
@@
-336,7
+336,7
@@
static clib_error_t *af_packet_set_mac_address_function
af_packet_main_t *apm = &af_packet_main;
af_packet_if_t *apif =
pool_elt_at_index (apm->interfaces, hi->dev_instance);
af_packet_main_t *apm = &af_packet_main;
af_packet_if_t *apif =
pool_elt_at_index (apm->interfaces, hi->dev_instance);
- int rv, fd
= socket (AF_UNIX, SOCK_DGRAM, 0)
;
+ int rv, fd;
struct ifreq ifr;
if (apif->mode == AF_PACKET_IF_MODE_IP)
struct ifreq ifr;
if (apif->mode == AF_PACKET_IF_MODE_IP)
@@
-347,6
+347,7
@@
static clib_error_t *af_packet_set_mac_address_function
" MAC update failed, interface is in IP mode");
}
" MAC update failed, interface is in IP mode");
}
+ fd = socket (AF_UNIX, SOCK_DGRAM, 0);
if (0 > fd)
{
vlib_log_warn (apm->log_class, "af_packet_%s could not open socket",
if (0 > fd)
{
vlib_log_warn (apm->log_class, "af_packet_%s could not open socket",