+static void
+ovs_router_lookup_cmd(struct unixctl_conn *conn, int argc OVS_UNUSED,
+ const char *argv[], void *aux OVS_UNUSED)
+{
+ ovs_be32 ip;
+ struct in6_addr ip6;
+ unsigned int plen;
+ char iface[IFNAMSIZ];
+ struct in6_addr gw;
+
+ if (scan_ipv4_route(argv[1], &ip, &plen) && plen == 32) {
+ in6_addr_set_mapped_ipv4(&ip6, ip);
+ } else if (!(scan_ipv6_route(argv[1], &ip6, &plen) && plen == 128)) {
+ unixctl_command_reply_error(conn, "Invalid parameters");
+ return;
+ }
+
+ if (ovs_router_lookup(&ip6, iface, &gw)) {
+ struct ds ds = DS_EMPTY_INITIALIZER;
+ ds_put_format(&ds, "gateway ");
+ ipv6_format_mapped(&ip6, &ds);
+ ds_put_format(&ds, "\ndev %s\n", iface);
+ unixctl_command_reply(conn, ds_cstr(&ds));
+ ds_destroy(&ds);
+ } else {
+ unixctl_command_reply_error(conn, "Not found");
+ }
+}
+