-/* 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");
* you may not use this file except in compliance with the License.
struct nlattr *attrs[ARRAY_SIZE(brc_multicast_policy)];
int retval;
- retval = nl_sock_create(NETLINK_GENERIC, 0, 0, 0, &sock);
+ retval = nl_sock_create(NETLINK_GENERIC, &sock);
if (retval) {
return retval;
}
return retval;
}
- retval = nl_sock_create(NETLINK_GENERIC, multicast_group, 0, 0, sock);
+ retval = nl_sock_create(NETLINK_GENERIC, sock);
if (retval) {
return retval;
}
- return 0;
+ retval = nl_sock_join_mcgroup(*sock, multicast_group);
+ if (retval) {
+ nl_sock_destroy(*sock);
+ *sock = NULL;
+ }
+ return retval;
}
static const struct nl_policy brc_dp_policy[] = {
if (sscanf(line, "%d %d "ETH_ADDR_SCAN_FMT" %d",
&port, &vlan, ETH_ADDR_SCAN_ARGS(mac), &age)
!= 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);
continue;
}
}
if (prune_timeout) {
- if (nl_sock_create(NETLINK_ROUTE, RTNLGRP_LINK, 0, 0, &rtnl_sock)) {
- ovs_fatal(0, "could not create rtnetlink socket");
+ int error;
+
+ error = nl_sock_create(NETLINK_ROUTE, &rtnl_sock);
+ if (error) {
+ ovs_fatal(error, "could not create rtnetlink socket");
+ }
+
+ error = nl_sock_join_mcgroup(rtnl_sock, RTNLGRP_LINK);
+ if (error) {
+ ovs_fatal(error, "could not join RTNLGRP_LINK multicast group");
}
}