1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** NetX Component                                                        */
16 /**                                                                       */
17 /**   Neighbor Discovery Cache                                            */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #define NX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "nx_api.h"
28 #include "nx_nd_cache.h"
29 
30 #ifdef FEATURE_NX_IPV6
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _nx_nd_cache_interface_entries_delete               PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Yuxin Zhou, Microsoft Corporation                                   */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function deletes entries associated with a specified interface */
44 /*    in the ND cache table.                                              */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    ip_ptr                               Pointer to IP instance         */
49 /*    index                                 IP interface index            */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    status                               Completion status              */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*    tx_mutex_get                          Obtain protection mutex       */
58 /*    tx_mutex_put                          Release protection mutex      */
59 /*    _nx_nd_cache_delete_internal          Actual function to remove an  */
60 /*                                            entry from the cache.       */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    Application Code                                                    */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
71 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
72 /*                                            resulting in version 6.1    */
73 /*                                                                        */
74 /**************************************************************************/
_nx_nd_cache_interface_entries_delete(NX_IP * ip_ptr,UINT index)75 UINT _nx_nd_cache_interface_entries_delete(NX_IP *ip_ptr, UINT index)
76 {
77 
78 NX_INTERFACE *interface_ptr;
79 UINT          i;
80 
81     interface_ptr = &(ip_ptr -> nx_ip_interface[index]);
82 
83     for (i = 0; i < NX_IPV6_NEIGHBOR_CACHE_SIZE; i++)
84     {
85         if (ip_ptr -> nx_ipv6_nd_cache[i].nx_nd_cache_interface_ptr == interface_ptr)
86         {
87 
88             _nx_nd_cache_delete_internal(ip_ptr, &ip_ptr -> nx_ipv6_nd_cache[i]);
89         }
90     }
91 
92     return(NX_SUCCESS);
93 }
94 #endif /* FEATURE_NX_IPV6 */
95 
96