[PATCH v2 0/3] MR3784: nsiproxy.sys: Implement ipv6_forward_enumerate_all.
-- v2: wldp: Add WldpQueryWindowsLockdownMode stub. nsiproxy.sys: Implement ipv6_forward_enumerate_all. wldp: Add WldpQueryWindowsLockdownMode stub. https://gitlab.winehq.org/wine/wine/-/merge_requests/3784
From: Helix Graziani <helix.graziani(a)hotmail.com> --- include/wldp.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/wldp.h b/include/wldp.h index 93f246fffa4..467e2ad8fe5 100644 --- a/include/wldp.h +++ b/include/wldp.h @@ -38,7 +38,11 @@ typedef enum _WLDP_WINDOWS_LOCKDOWN_MODE WLDP_WINDOWS_LOCKDOWN_MODE_TRIAL, WLDP_WINDOWS_LOCKDOWN_MODE_LOCKED, WLDP_WINDOWS_LOCKDOWN_MODE_MAX +<<<<<<< HEAD } WLDP_WINDOWS_LOCKDOWN_MODE, *PWLDP_WINDOWS_LOCKDOWN_MODE; +======= +} WLDP_WINDOWS_LOCKDOWN_MODE; +>>>>>>> ff16e11db93 (wldp: Add WldpQueryWindowsLockdownMode stub.) typedef struct WLDP_HOST_INFORMATION { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3784
From: Helix Graziani <helix.graziani(a)hotmail.com> --- dlls/nsiproxy.sys/ip.c | 136 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 2 deletions(-) diff --git a/dlls/nsiproxy.sys/ip.c b/dlls/nsiproxy.sys/ip.c index dbe3a0b46b7..fd187e3863e 100644 --- a/dlls/nsiproxy.sys/ip.c +++ b/dlls/nsiproxy.sys/ip.c @@ -1482,13 +1482,145 @@ static NTSTATUS ipv4_forward_enumerate_all( void *key_data, UINT key_size, void return status; } +struct ipv6_route_data +{ + NET_LUID luid; + UINT if_index; + struct in6_addr prefix; + UINT prefix_len; + struct in6_addr next_hop; + UINT metric; + UINT protocol; + BYTE loopback; +}; + +static void ipv6_forward_fill_entry( struct ipv6_route_data *entry, struct nsi_ipv6_forward_key *key, + struct nsi_ip_forward_rw *rw, struct nsi_ipv6_forward_dynamic *dyn, + struct nsi_ip_forward_static *stat ) +{ + if (key) + { + key->unk = 0; + memcpy( key->prefix.u.Byte, entry->prefix.s6_addr, 16 ); + key->prefix_len = entry->prefix_len; + memset( key->unk2, 0, sizeof(key->unk2) ); + memset( key->unk3, 0, sizeof(key->unk3) ); + key->luid = entry->luid; + key->luid2 = entry->luid; + memcpy( key->next_hop.u.Byte, entry->next_hop.s6_addr, 16 ); + key->pad = 0; + } + + if (rw) + { + rw->site_prefix_len = 0; + rw->valid_lifetime = ~0u; + rw->preferred_lifetime = ~0u; + rw->metric = entry->metric; + rw->protocol = entry->protocol; + rw->loopback = entry->loopback; + rw->autoconf = 1; + rw->publish = 0; + rw->immortal = 1; + memset( rw->unk, 0, sizeof(rw->unk) ); + rw->unk2 = 0; + } + + if (dyn) + { + memset( dyn, 0, sizeof(*dyn) ); + } + + if (stat) + { + stat->origin = NlroManual; + stat->if_index = entry->if_index; + } +} + +struct in6_addr str_to_in6_addr(char *nptr, char **endptr) +{ + struct in6_addr ret; + + for (int i = 0; i < 16; i++) + { + if (!isalnum( *nptr ) || !isalnum( *nptr+1 )) + { + /* invalid hex string */ + if (endptr) *endptr = nptr; + return ret; + } + + sscanf( nptr, "%2hhx", &ret.s6_addr[i] ); + nptr += 2; + } + + if (endptr) *endptr = nptr; + + return ret; +} + static NTSTATUS ipv6_forward_enumerate_all( void *key_data, UINT key_size, void *rw_data, UINT rw_size, void *dynamic_data, UINT dynamic_size, void *static_data, UINT static_size, UINT_PTR *count ) { + UINT num = 0; + NTSTATUS status = STATUS_SUCCESS; + BOOL want_data = key_size || rw_size || dynamic_size || static_size; + struct ipv6_route_data entry; + + TRACE( "%p %d %p %d %p %d %p %d %p" , key_data, key_size, rw_data, rw_size, + dynamic_data, dynamic_size, static_data, static_size, count ); + +#ifdef __linux__ + { + char buf[512], *ptr; + UINT rtf_flags; + FILE *fp; + + if (!(fp = fopen( "/proc/net/ipv6_route", "r" ))) return STATUS_NOT_SUPPORTED; + + while ((ptr = fgets( buf, sizeof(buf), fp ))) + { + while (!isspace( *ptr )) ptr++; + *ptr++ = '\0'; + + entry.prefix = str_to_in6_addr( ptr, &ptr ); + entry.prefix_len = strtoul( ptr + 1, &ptr, 16 ); + str_to_in6_addr( ptr + 1, &ptr ); /* source network, skip */ + strtoul( ptr + 1, &ptr, 16 ); /* source prefix length, skip */ + entry.next_hop = str_to_in6_addr( ptr + 1, &ptr ); + entry.metric = strtoul( ptr + 1, &ptr, 16 ); + strtoul( ptr + 1, &ptr, 16 ); /* refcount, skip */ + strtoul( ptr + 1, &ptr, 16 ); /* use, skip */ + rtf_flags = strtoul( ptr + 1, &ptr, 16); + entry.protocol = (rtf_flags & RTF_GATEWAY) ? MIB_IPPROTO_NETMGMT : MIB_IPPROTO_LOCAL; + entry.loopback = entry.protocol == MIB_IPPROTO_LOCAL && entry.prefix_len == 32; + + if (!convert_unix_name_to_luid( ptr, &entry.luid )) continue; + if (!convert_luid_to_index( &entry.luid, &entry.if_index )) continue; + + if (num < *count) + { + ipv6_forward_fill_entry( &entry, key_data, rw_data, dynamic_data, static_data ); + key_data = (BYTE *)key_data + key_size; + rw_data = (BYTE *)rw_data + rw_size; + dynamic_data = (BYTE *)dynamic_data + dynamic_size; + static_data = (BYTE *)static_data + static_size; + } + num++; + } + fclose(fp); + } +#else FIXME( "not implemented\n" ); - *count = 0; - return STATUS_SUCCESS; + return STATUS_NOT_IMPLEMENTED; +#endif + + if (!want_data || num <= *count) *count = num; + else status = STATUS_BUFFER_OVERFLOW; + + return status; } static struct module_table ipv4_tables[] = -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3784
From: Helix Graziani <helix.graziani(a)hotmail.com> --- include/wldp.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/wldp.h b/include/wldp.h index 467e2ad8fe5..fba335aed37 100644 --- a/include/wldp.h +++ b/include/wldp.h @@ -39,10 +39,14 @@ typedef enum _WLDP_WINDOWS_LOCKDOWN_MODE WLDP_WINDOWS_LOCKDOWN_MODE_LOCKED, WLDP_WINDOWS_LOCKDOWN_MODE_MAX <<<<<<< HEAD +<<<<<<< HEAD } WLDP_WINDOWS_LOCKDOWN_MODE, *PWLDP_WINDOWS_LOCKDOWN_MODE; ======= } WLDP_WINDOWS_LOCKDOWN_MODE;
> ff16e11db93 (wldp: Add WldpQueryWindowsLockdownMode stub.) +======= +} WLDP_WINDOWS_LOCKDOWN_MODE, *PWLDP_WINDOWS_LOCKDOWN_MODE; +>>>>>>> 1d6a6ebb16a (wldp: Add WldpQueryWindowsLockdownMode stub.)
typedef struct WLDP_HOST_INFORMATION { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3784
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=137320 Your paranoid android. === debian11 (build log) === ../wine/include/wldp.h:41:1: error: version control conflict marker in file ../wine/include/wldp.h:44:1: error: version control conflict marker in file ../wine/include/wldp.h:46:1: error: version control conflict marker in file ../wine/include/wldp.h:48:29: error: expected identifier or ���(��� before ���,��� token ../wine/include/wldp.h:49:1: error: version control conflict marker in file ../wine/include/wldp.h:49:9: error: invalid suffix "d6a6ebb16a" on integer constant ../wine/include/wldp.h:59:38: error: expected declaration specifiers or ���...��� before ���WLDP_HOST_INFORMATION��� ../wine/dlls/wldp/wldp.c:45:38: error: expected declaration specifiers or ���...��� before ���WLDP_HOST_INFORMATION��� Task: The win32 Wine build failed === debian11b (build log) === ../wine/include/wldp.h:41:1: error: version control conflict marker in file ../wine/include/wldp.h:44:1: error: version control conflict marker in file ../wine/include/wldp.h:46:1: error: version control conflict marker in file ../wine/include/wldp.h:48:29: error: expected identifier or ���(��� before ���,��� token ../wine/include/wldp.h:49:1: error: version control conflict marker in file ../wine/include/wldp.h:49:9: error: invalid suffix "d6a6ebb16a" on integer constant ../wine/include/wldp.h:59:38: error: expected declaration specifiers or ���...��� before ���WLDP_HOST_INFORMATION��� ../wine/dlls/wldp/wldp.c:45:38: error: expected declaration specifiers or ���...��� before ���WLDP_HOST_INFORMATION��� Task: The wow64 Wine build failed
participants (3)
-
Helix Graziani -
Helix Graziani (@TornadoCookie) -
Marvin