summary refs log tree commit diff stats
path: root/slirp/src/ndp_table.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-04-24 13:00:41 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-05-03 00:15:37 +0200
commit7c57bdd82026ba03f3158bbcd841afde7c2dc43a (patch)
tree4ddb7c7ccbe33e6158ee4a9c4ae2f0a67e227bf4 /slirp/src/ndp_table.c
parent816956014e92d04d458900d2b8815b5bf3ac5a4d (diff)
downloadfocaccia-qemu-7c57bdd82026ba03f3158bbcd841afde7c2dc43a.tar.gz
focaccia-qemu-7c57bdd82026ba03f3158bbcd841afde7c2dc43a.zip
build-sys: move slirp as git submodule project
The slirp project is now hosted on freedesktop at:
https://gitlab.freedesktop.org/slirp.

The libslirp source was extracted from qemu/slirp filtered through
clang-format (available in project tree). The qemu slirp directory can
be swapped by a git submodule.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190424110041.8175-3-marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/src/ndp_table.c')
-rw-r--r--slirp/src/ndp_table.c87
1 files changed, 0 insertions, 87 deletions
diff --git a/slirp/src/ndp_table.c b/slirp/src/ndp_table.c
deleted file mode 100644
index 78324877e2..0000000000
--- a/slirp/src/ndp_table.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause */
-/*
- * Copyright (c) 2013
- * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
- */
-
-#include "slirp.h"
-
-void ndp_table_add(Slirp *slirp, struct in6_addr ip_addr,
-                    uint8_t ethaddr[ETH_ALEN])
-{
-    char addrstr[INET6_ADDRSTRLEN];
-    NdpTable *ndp_table = &slirp->ndp_table;
-    int i;
-
-    inet_ntop(AF_INET6, &(ip_addr), addrstr, INET6_ADDRSTRLEN);
-
-    DEBUG_CALL("ndp_table_add");
-    DEBUG_ARG("ip = %s", addrstr);
-    DEBUG_ARG("hw addr = %02x:%02x:%02x:%02x:%02x:%02x",
-              ethaddr[0], ethaddr[1], ethaddr[2],
-              ethaddr[3], ethaddr[4], ethaddr[5]);
-
-    if (IN6_IS_ADDR_MULTICAST(&ip_addr) || in6_zero(&ip_addr)) {
-        /* Do not register multicast or unspecified addresses */
-        DEBUG_CALL(" abort: do not register multicast or unspecified address");
-        return;
-    }
-
-    /* Search for an entry */
-    for (i = 0; i < NDP_TABLE_SIZE; i++) {
-        if (in6_equal(&ndp_table->table[i].ip_addr, &ip_addr)) {
-            DEBUG_CALL(" already in table: update the entry");
-            /* Update the entry */
-            memcpy(ndp_table->table[i].eth_addr, ethaddr, ETH_ALEN);
-            return;
-        }
-    }
-
-    /* No entry found, create a new one */
-    DEBUG_CALL(" create new entry");
-    ndp_table->table[ndp_table->next_victim].ip_addr = ip_addr;
-    memcpy(ndp_table->table[ndp_table->next_victim].eth_addr,
-            ethaddr, ETH_ALEN);
-    ndp_table->next_victim = (ndp_table->next_victim + 1) % NDP_TABLE_SIZE;
-}
-
-bool ndp_table_search(Slirp *slirp, struct in6_addr ip_addr,
-                      uint8_t out_ethaddr[ETH_ALEN])
-{
-    char addrstr[INET6_ADDRSTRLEN];
-    NdpTable *ndp_table = &slirp->ndp_table;
-    int i;
-
-    inet_ntop(AF_INET6, &(ip_addr), addrstr, INET6_ADDRSTRLEN);
-
-    DEBUG_CALL("ndp_table_search");
-    DEBUG_ARG("ip = %s", addrstr);
-
-    assert(!in6_zero(&ip_addr));
-
-    /* Multicast address: fec0::abcd:efgh/8 -> 33:33:ab:cd:ef:gh */
-    if (IN6_IS_ADDR_MULTICAST(&ip_addr)) {
-        out_ethaddr[0] = 0x33; out_ethaddr[1] = 0x33;
-        out_ethaddr[2] = ip_addr.s6_addr[12];
-        out_ethaddr[3] = ip_addr.s6_addr[13];
-        out_ethaddr[4] = ip_addr.s6_addr[14];
-        out_ethaddr[5] = ip_addr.s6_addr[15];
-        DEBUG_ARG("multicast addr = %02x:%02x:%02x:%02x:%02x:%02x",
-                  out_ethaddr[0], out_ethaddr[1], out_ethaddr[2],
-                  out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]);
-        return 1;
-    }
-
-    for (i = 0; i < NDP_TABLE_SIZE; i++) {
-        if (in6_equal(&ndp_table->table[i].ip_addr, &ip_addr)) {
-            memcpy(out_ethaddr, ndp_table->table[i].eth_addr,  ETH_ALEN);
-            DEBUG_ARG("found hw addr = %02x:%02x:%02x:%02x:%02x:%02x",
-                      out_ethaddr[0], out_ethaddr[1], out_ethaddr[2],
-                      out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]);
-            return 1;
-        }
-    }
-
-    DEBUG_CALL(" ip not found in table");
-    return 0;
-}