@@ -87,8 +87,13 @@ struct dispatch_args {
int odp_netmap_init_global(void)
{
+ int i;
odp_spinlock_init(&nm_global_lock);
memset(netmap_devs, 0, sizeof(netmap_devs));
+
+ for (i = 0; i < MAX_DEVS; i++)
+ netmap_devs[i].sockfd = -1;
+
return 0;
}
@@ -148,9 +153,9 @@ static int get_mac_addr(pkt_netmap_t *pkt_nm)
int sockfd;
int err;
- sockfd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+ sockfd = pkt_nm->nm_dev->sockfd;
if (sockfd == -1) {
- ODP_ERR("socket(): %s\n", strerror(errno));
+ ODP_ERR("Error: invalid device control socket\n");
goto error;
}
The get_mac_addr function created a socket that was never freed. The device control socket should have been used instead Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> --- platform/linux-netmap/odp_packet_netmap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)