diff options
author | RajithaY <rajithax.yerrumsetty@intel.com> | 2017-04-25 03:31:15 -0700 |
---|---|---|
committer | Rajitha Yerrumchetty <rajithax.yerrumsetty@intel.com> | 2017-05-22 06:48:08 +0000 |
commit | bb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch) | |
tree | ca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/roms/SLOF/clients/net-snk/app/netlib/ndp.c | |
parent | a14b48d18a9ed03ec191cf16b162206998a895ce (diff) |
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to
kvmfornfv repo and make use of the updated latest qemu for the
execution of all testcase
Change-Id: I1280af507a857675c7f81d30c95255635667bdd7
Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/roms/SLOF/clients/net-snk/app/netlib/ndp.c')
-rw-r--r-- | qemu/roms/SLOF/clients/net-snk/app/netlib/ndp.c | 166 |
1 files changed, 0 insertions, 166 deletions
diff --git a/qemu/roms/SLOF/clients/net-snk/app/netlib/ndp.c b/qemu/roms/SLOF/clients/net-snk/app/netlib/ndp.c deleted file mode 100644 index 96faa8716..000000000 --- a/qemu/roms/SLOF/clients/net-snk/app/netlib/ndp.c +++ /dev/null @@ -1,166 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2013 IBM Corporation - * All rights reserved. - * This program and the accompanying materials - * are made available under the terms of the BSD License - * which accompanies this distribution, and is available at - * http://www.opensource.org/licenses/bsd-license.php - * - * Contributors: - * IBM Corporation - initial implementation - *****************************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <netlib/ipv6.h> -#include <netlib/icmpv6.h> -#include <netlib/ndp.h> - -/* Neighbor cache */ -static struct neighbor *first_neighbor; -static struct neighbor *last_neighbor; - -/* Router list */ -static struct router *first_router; -static struct router *last_router; - -/* - * NET: add new router to list - * @param struct router nghb - new router - * @return true or false - */ -int8_t -router_add (struct router *nghb ) -{ - if (nghb == NULL) - return -1; - - if (first_router == NULL) { - first_router= nghb; - last_router = first_router; - last_router->next = NULL; - } else { - last_router->next = nghb; - last_router = nghb; - last_router->next = NULL; - } - return 1; /* no error */ -} - -/* - * NET: create a new router - * @param uint8_t *packet - received packet (Ethernet/IPv6/ICMPv6/ND_NghSlct) - * @param struct packeth - pointers to headers in packet - * @return pointer to new router - */ -void * -router_create (uint8_t *mac, ip6_addr_t *ip) -{ - struct router *new_router; - - new_router = malloc (sizeof(struct router)); - if( !new_router) { - return 0; - } - memset (new_router, 0, sizeof(struct router)); - - /* fill neighbor struct */ - memcpy (new_router->mac, mac, 6); - memcpy (&(new_router->ip.addr[0]), &(ip->addr[0]), IPV6_ADDR_LENGTH); - - return new_router; -} - -struct router * -find_router( ip6_addr_t *ip ) -{ - struct router *n = NULL; - - for (n = first_router; n != NULL ; n=n->next) - if (ip6_cmp (&(n->ip), ip)) - return n; /* router is already in list*/ - - return NULL; /* router is unknown */ -} - -/* - * NET: add new neighbor to list - * @param struct neighbor nghb - new neighbor - * @return true or false - */ -int8_t -neighbor_add (struct neighbor *nghb) -{ - if (nghb == NULL) - return -1; - - if (first_neighbor == NULL) { - first_neighbor = nghb; - last_neighbor = first_neighbor; - last_neighbor->next = NULL; - } else { - last_neighbor->next = nghb; - last_neighbor = nghb; - last_neighbor->next = NULL; - } - - return 1; /* no error */ -} - -/* - * NET: create a new neighbor - * @param uint8_t *packet - received packet (Ethernet/IPv6/ICMPv6/ND_NghSlct) - * @param struct packeth - pointers to headers in packet - * @return pointer - pointer to new neighbor - * NULL - malloc failed - */ -void * -neighbor_create (uint8_t *packet, struct packeth *headers) -{ - struct neighbor *new_neighbor; - - new_neighbor = malloc (sizeof(struct neighbor)); - if( !new_neighbor ) - return NULL; - - /* fill neighbor struct */ - memcpy (&(new_neighbor->mac), - &(headers->ethh->src_mac[0]), 6); - memcpy (&(new_neighbor->ip.addr), &(headers->ip6h->src), IPV6_ADDR_LENGTH); - new_neighbor->status = NB_INCOMPLETE; - - return new_neighbor; -} - -/** - * NET: Find neighbor with given IPv6 address in Neighbor Cache - * - * @param ip - Pointer to IPv6 address - * @return pointer - pointer to client IPv6 address (e.g. ::1) - * NULL - Neighbor not found - */ -struct neighbor * -find_neighbor (ip6_addr_t *ip) -{ - struct neighbor *n = NULL; - - for (n = first_neighbor; n != NULL ; n=n->next) { - if (ip6_cmp (&(n->ip), ip)) { - return n; /* neighbor is already in cache */ - } - } - - return NULL; /* neighbor is unknown */ -} - -void ndp_init(void) -{ - /* Router list */ - first_router = NULL; - last_router = first_router; - - /* Init Neighbour cache */ - first_neighbor = NULL; - last_neighbor = first_neighbor; -} |