1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 #define NX_SOURCE_CODE 13 14 15 /* Include necessary system files. */ 16 17 #include "nx_api.h" 18 #include "nx_ipv6.h" 19 #include "nx_nd_cache.h" 20 21 22 23 24 #ifdef FEATURE_NX_IPV6 25 /**************************************************************************/ 26 /**************************************************************************/ 27 /** */ 28 /** NetX Component */ 29 /** */ 30 /** Internet Protocol version 6 Prefix Table (IPv6 prefix table) */ 31 /** */ 32 /**************************************************************************/ 33 /**************************************************************************/ 34 35 36 37 38 /**************************************************************************/ 39 /* */ 40 /* FUNCTION RELEASE */ 41 /* */ 42 /* _nx_ipv6_prefix_list_delete PORTABLE C */ 43 /* 6.1 */ 44 /* AUTHOR */ 45 /* */ 46 /* Yuxin Zhou, Microsoft Corporation */ 47 /* */ 48 /* DESCRIPTION */ 49 /* */ 50 /* This internal function deletes an entry from the prefix list based */ 51 /* on the given prefix. */ 52 /* */ 53 /* */ 54 /* INPUT */ 55 /* */ 56 /* ip_ptr Pointer to IP control block */ 57 /* prefix 128-bit IPv6 prefix. */ 58 /* prefix_length Length of the prefix. */ 59 /* */ 60 /* OUTPUT */ 61 /* */ 62 /* None */ 63 /* */ 64 /* CALLS */ 65 /* */ 66 /* _nx_ipv6_prefix_list_delete_entry Delete IPv6 prefix entry */ 67 /* */ 68 /* CALLED BY */ 69 /* */ 70 /* _nx_icmpv6_process_ra ICMPv6 Router Advertisement */ 71 /* process routine. */ 72 /* */ 73 /* NOTE */ 74 /* */ 75 /* This function cannot be called from ISR. */ 76 /* */ 77 /* RELEASE HISTORY */ 78 /* */ 79 /* DATE NAME DESCRIPTION */ 80 /* */ 81 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 82 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 83 /* resulting in version 6.1 */ 84 /* */ 85 /**************************************************************************/ _nx_ipv6_prefix_list_delete(NX_IP * ip_ptr,ULONG * prefix,INT prefix_length)86VOID _nx_ipv6_prefix_list_delete(NX_IP *ip_ptr, ULONG *prefix, INT prefix_length) 87 { 88 89 NX_IPV6_PREFIX_ENTRY *current; 90 91 92 /* Quick reference to the head of the prefix list. */ 93 current = ip_ptr -> nx_ipv6_prefix_list_ptr; 94 95 /* Go through all the entries. */ 96 while (current) 97 { 98 99 /* If prefix length matches, and the prefix addresses also match...*/ 100 if ((current -> nx_ipv6_prefix_entry_prefix_length == (ULONG)prefix_length) && 101 CHECK_IPV6_ADDRESSES_SAME(prefix, current -> nx_ipv6_prefix_entry_network_address)) 102 { 103 104 /* Delete this entry. */ 105 _nx_ipv6_prefix_list_delete_entry(ip_ptr, current); 106 107 /* All done. return */ 108 return; 109 } 110 /* Move to the next entry. */ 111 current = current -> nx_ipv6_prefix_entry_next; 112 } 113 114 /* No match was found. */ 115 return; 116 } 117 118 119 #endif /* FEATURE_NX_IPV6 */ 120 121