#include "packets.h"
#include "poll-loop.h"
#include "shash.h"
+#include "sset.h"
#include "unixctl.h"
#include "vlog.h"
NULL, /* get_in6 */
NULL, /* add_router */
NULL, /* get_next_hop */
- NULL, /* get_status */
+ NULL, /* get_drv_info */
NULL, /* arp_lookup */
netdev_dummy_update_flags,
dummy_dev = shash_find_data(&dummy_netdev_devs, argv[1]);
if (!dummy_dev) {
- unixctl_command_reply(conn, 501, "no such dummy netdev");
+ unixctl_command_reply_error(conn, "no such dummy netdev");
return;
}
packet = eth_from_packet_or_flow(argv[i]);
if (!packet) {
- unixctl_command_reply(conn, 501, "bad packet syntax");
+ unixctl_command_reply_error(conn, "bad packet syntax");
return;
}
}
if (!n_listeners) {
- unixctl_command_reply(conn, 202, "packets queued but nobody listened");
+ unixctl_command_reply(conn, "packets queued but nobody listened");
} else {
- unixctl_command_reply(conn, 200, "success");
+ unixctl_command_reply(conn, "success");
}
}
void
-netdev_dummy_register(void)
+netdev_dummy_register(bool override)
{
- netdev_register_provider(&dummy_class);
unixctl_command_register("netdev-dummy/receive", "NAME PACKET|FLOW...",
2, INT_MAX, netdev_dummy_receive, NULL);
+
+ if (override) {
+ struct sset types;
+ const char *type;
+
+ sset_init(&types);
+ netdev_enumerate_types(&types);
+ SSET_FOR_EACH (type, &types) {
+ if (!netdev_unregister_provider(type)) {
+ struct netdev_class *class;
+
+ class = xmalloc(sizeof *class);
+ *class = dummy_class;
+ class->type = xstrdup(type);
+ netdev_register_provider(class);
+ }
+ }
+ sset_destroy(&types);
+ }
+ netdev_register_provider(&dummy_class);
}