Commit Graph

142 Commits

Author SHA1 Message Date
Eric Kohl
07d30c679e [TCPIP] Read the interface metric from the registry or use the automatic metric feature
- Read the interface metric from the registry.
- Assign an automatic metric to an interface if a registry value is not available.
- Determine the automatic metric from the link speed. The metric for the loopback interface is always 1.
2026-03-14 21:10:56 +01:00
Eric Kohl
606d22d6c0 [TCPIP] Map 127.x.x.x addresses to the loopback address
- Identify 127.x.x.x addresses as on-link addresses.
- Modify the neighbor cache to map all 127.x.x.x addresses to the loopback address (127.0.0.1).
- Create a single entry for all 127.x.x.x addresses instead of one entry per address. This entry belongs to the loopback address.

CORE-7484
2026-03-14 16:01:31 +01:00
Ivan Georgiev
a70f59b0dd [DRIVERS] Replace obsolete RtlConvert*ToLargeInteger calls with inline equivalents (#8721)
RtlConvertUlongToLargeInteger and RtlConvertLongToLargeInteger are
obsolete NT routines that assign a 32-bit integer to LARGE_INTEGER.QuadPart.
Replace all driver/DLL usages with inline .QuadPart assignments or
standard C/C++ casts. This removes unnecessary function calls.

CORE-19438
2026-03-14 13:29:02 +03:00
Mikhail Tyukin
c5c0e5987d [MSAFD][AFD] Implement WSPConnectEx and SO_UPDATE_CONNECT_CONTEXT (#8636)
- Update AFD to use the shared structure
- Fix AFD get context to match windows behavior
- implement SO_UPDATE_CONNECT_CONTEXT

CORE-17174
CORE-16335
2026-02-04 00:14:55 -06:00
Mikhail Tyukin
4e7a64b3ec [MSAFD][AFD] Asynchronous connection support (#8573)
* [MSAFD] async support

- Allow APCs to be processed while waiting for blocking IO
- Remove SleepEx hacks

[MSAFD][AFD][TCPIP] Patch CORE-12152

Original author: Peter Hater <7element@mail.bg>

TCPConnect: Always copy bind address into connection.

[MSAFD] SetSocketInformation: Remove unnecessary TRACE code blocks

[MSAFD] AfdRecvAPC and AfdSendAPC: Remove unnecessary NULL checks

[MSAFD] WSPRecv, WSPRecvFrom and WSPSend: Fix leaks and fix IOCTL input buffer handling

[MSAFD] Rewrite WSPSendTo

[MSAFD] Rewrite WSPConnect and AfdConnectAPC

[MSAFD] Remove hacky SleepEx calls

[MSAFD] Don't wait with no timeout

[MSAFD] send/receive: Fixes for overlapped socket

- Fix IOCTL buffers handling
- Allow APC to be processed

[MSAFD] connect: Fixes for async connect

- Allow APC to be processed
- Remove "mark as connected" hack for non-blocking socket

[MSAFD] Get/SetSocketInformation: Fixes for overlapped socket

- Fix IOCTL buffer handling
- Allow APC to be processed

[MSAFD] APC fixes

Fix New Moon 28 crash on website ads.

[MSAFD] Code cleanup

- Rename APC context data type
- Rename APC functions (Afd* -> Msafd*)
- Add SAL annotation
- BUGBUG -> FIXME
- Use sizeof(*ptr) instead of sizeof(type)
- Fix debug prints

[MSAFD] Add comment for SleepEx hacks

[MSAFD] WSPGetOverlappedResult: Fix failed ws2_32:recv tests

[MSAFD] WSPConnect: Fix IOCTL status handling

[MSAFD] send/receive: Simplify IOCTL status handling

[MSAFD] Get/SetSocketInformation: Simplify IOCTL status handling

Co-Authored-By: Emmanuel Gonzalez <momo16136@tamu.edu>
Co-Authored-By: Julio Carchi Ruiz <juliocarchi@yahoo.com>

* [MSAFD] Fixes
- pass overlapped structure pointer to apc context when there no completion routine. .NET expects this behavior
- Fix WSPGetOverlappedResult to return flags and status code upon failure
---------
Original author: Peter Hater <7element@mail.bg>
Co-authored-by: Thamatip Chitpong <thamatip.chitpong@reactos.org>
Co-authored-by: Emmanuel Gonzalez <momo16136@tamu.edu>
Co-authored-by: Julio Carchi Ruiz <juliocarchi@yahoo.com>
2026-01-18 13:42:24 -06:00
Max Korostil
e04d05254a [NDIS] Add IRP_MN_REMOVE_DEVICE processing (#8365)
Fixes BSOD after installation of HotSpot Shield 3.42.

CORE-20150
2025-12-31 15:36:15 +03:00
Johannes Thoma
b18a46e315 [NETIO] Implement an in-kernel BSD-style networking API driver
This patch adds the NETIO.SYS driver to ReactOS. NETIO.SYS
is part of Windows since NT6 (Vista).

The driver is not feature complete (meaning some functionality is
unimplemented) but does its job quite good for what it originally
was written for (which is getting WinDRBD working on
ReactOS/Windows Server 2003 SP2).

The driver re-uses parts of the AFD.SYS driver, namely those
functions that ease communitating with the transport device
interface (TDI). Other than that, following features are implemented
and should work:

 * TCP/IP networking: connect, listen, accept, read, write
 * UDP/IP networking: write

So in a nutshell TCP/IP support is completed, UDP support is
partially complete and ICMP support does not exist yet.
In particular the listen/accept mechanism allows one to write
kernel side TCP servers that one can connect to via the internet.

The netio driver is licensed under the MIT license, see the file
netio.c for more details.

Have fun with it :)

Signed-off-by: Johannes Khoshnazar-Thoma <johannes@johannesthoma.com>
2025-11-21 21:08:03 +02:00
Johannes Thoma
c425244a36 [TDIHELPERS] Move TDI helpers from AFD driver to separate directory
We want to use the TDI helper functions also in the NETIO.SYS
driver which comes with the next commit. The code was modernized
a bit (usage of DPRINT, doxygen style comments) but other than
that it was left unchanged.
2025-11-21 21:08:03 +02:00
Hervé Poussineau
5bfaecdab0 [E1000] Mark register bits as unsigned 2025-11-09 09:06:39 +01:00
Adam Słaboń
3000d45250 [NETKVM] Reduce log level and default to 10 Gbit/s connection (#8448)
Reduces debug spam and maybe improves network throughput a bit.

CORE-15841
2025-11-05 13:20:36 +03:00
Hermès Bélusca-Maïto
df49026976 [NETWORK:NE2000] Move the NDIS_* defines to the CMakeFiles.txt 2025-10-26 18:23:54 +01:00
Serge Gautherie
5b1224b8a3 [NETWORK:DD][NDIS] Be explicit about NDIS_LEGACY_MINIPORT value (#8315)
Also, NDIS_LEGACY_DRIVER and NDIS_LEGACY_PROTOCOL.
2025-10-26 18:23:53 +01:00
Serge Gautherie
04f052bec8 [NETWORK:DD] NDIS_MINIPORT_DRIVER and NDIS51_MINIPORT do not need a value (#8315) 2025-10-26 18:23:48 +01:00
Serge Gautherie
ca2fb5f666 [NDIS] NdisRegisterProtocol(): Add a comment about NDIS51 (#8314)
CORE-20300

- `NdisRegisterProtocol()`: Add a comment about `NDIS51`: the
  `NDIS50_PROTOCOL_CHARACTERISTICS` structure is common to both
  NDIS 5.0 and 5.1.
  This is in contrast to the `NDIS50/NDIS51_MINIPORT_CHARACTERISTICS`
  structures, see for example commit 3e169e3cb2 (r49961).

- Remove obsolete SOURCES file. Addendum to commit d9e83ed22d (r40142).
2025-10-26 17:28:51 +01:00
Serge Gautherie
dd00ebdd51 [PCNET] CMakeLists.txt: Remove superseded -DNDIS50_MINIPORT (#8313)
Addendum to commit 74015adb69 (r20671).
CORE-20300
2025-10-26 17:17:07 +01:00
Serge Gautherie
5ae1c72395 [NDIS] NDIS_TAG: Fix definition and usages (#8243)
- Let it be `"NDIS"`, instead of variations of `"SIMN"`.
- Use matching `ExFreePoolWithTag()`.
- Remove a redundant `KeyInformation = NULL;`.

Addendum to commits e8861acfb2 (r12196) and 5658b2154c (r53045).
CORE-18791
2025-08-16 19:01:55 +02:00
Serge Gautherie
f100d34638 [NDIS][PSDK] Define IOCTL_NDIS_RESERVED7 and add a stub (#8240)
Another small step, until further investigation and implementation.

CORE-13831
2025-08-16 19:54:21 +03:00
Oleg Dubinskiy
62f9d1ad46 [TCPIP] Return MIB_IF_TYPE_ETHERNET for WLAN adapter types when compiling ReactOS as NT 5.2 (#8300)
Split Windows Server 2003 and Windows Vista behaviour in two different cases and make them used separately: when ReactOS target version is NT 5.2, use the 1st case, otherwise use the 2nd one instead.
Also, handle NdisPhysicalMediumNative802_11 case only for NT 6.0 and newer, since that's actually supported starting from NDIS 6.0, according to MSDN:
https://learn.microsoft.com/en-us/windows-hardware/drivers/network/oid-gen-physical-medium
while for NDIS 5.1 and newer it's:
https://learn.microsoft.com/en-us/previous-versions/windows/hardware/network/ff560255(v=vs.85)
This fixes:
1. A critical regression with unavailable networking in ReactOS when 3rd-party NT5-compatible Ethernet/Wi-Fi drivers are used (both in VM and on real hardware) caused by commit 3842b59f75 from @EricKohl.
2. Failure to open Network Properties and Network Status from the Network tray icon (caused by the same commit too).
MSDN tells us this is done so for Windows XP and Server 2003 as well, and IF_TYPE_IEEE80211 is returned only in Windows Vista and newer, so the following Microsoft documentation is actually correct in this case:
https://learn.microsoft.com/en-us/windows/win32/api/iptypes/ns-iptypes-ip_adapter_info
(see the information about "IP_ADAPTER_INFO.Type" member below on that page)
!!!Please note that the behaviour of Vista+ case (e. g., when compiling ReactOS targeted as NT 6.0 and newer) remains unchanged after this fix (networking still may not work), so it still requires the proper support of 3rd-party NT6+ compatible network miniport drivers (by handling this case via the Vista/NDIS6-style way) for NT6 target!!!
CORE-20244
2025-08-08 16:10:50 +02:00
Timo Kreuzer
b7066b9232 [TCPIP] Fix "mbox" queue synchronization
Use a KSEMAPHORE instead of a NotificationEvent to signal availability. This is to prevent satisfying the wait for multiple waiters, when only a single entry is on the list.
Fixes crashes on SMP builds.
2025-08-05 09:15:07 +03:00
Timo Kreuzer
069fc049db [TCPIP] Fix global synchronization on SMP
We cannot just raise IRQL! Instead use a global ERESOURCE, which allows to be acquired recursively, as required by LWIP.
2025-08-05 09:15:07 +03:00
Hervé Poussineau
7b9ef6b390 [NDIS] NdisOpenFile: close file locally, as we don't need it later
Remove now unused field FileHandle in NDIS_HANDLE_OBJECT structure.
2025-06-29 08:23:33 +02:00
Hervé Poussineau
e2904d3baf [NDIS] NdisOpenFile: read file contents into buffer when opening it
NdisMapFile now returns a non-null buffer.

CORE-20259
2025-06-29 08:23:33 +02:00
Hervé Poussineau
d72bcb149f [NDIS] NdisOpenFile: retrieve and return file length in *FileLength
CORE-20259
2025-06-29 08:23:32 +02:00
Hervé Poussineau
07f305cd59 [NDIS] NdisOpenFile: use local variables instead of using output variables 2025-06-29 08:23:32 +02:00
Timo Kreuzer
e431470ff9 [REACTOS] Fix build with VS 17.14.2 / CL 19.44.35207.1 2025-05-31 09:51:33 +00:00
Eric Kohl
99e2606982 [DC21x4][ne2000][netkvm][nvnet][pcnet][rtl8139] Implement OID_GEN_PHYSICAL_MEDIUM
CORE-20206
2025-05-25 23:48:38 +02:00
Timo Kreuzer
4cb4eee23a [E1000] Implement OID_GEN_PHYSICAL_MEDIUM 2025-05-22 18:37:55 +00:00
Eric Kohl
3842b59f75 [TCPIP] Retrieve the interface medium type from NDIS
Send OID_GEN_PHYSICAL_MEDIUM and OID_GEN_MEDIA_SUPPORTED query requests to NDIS.

This will enable us to distinguish wired and wireless ethernet adapters.
2025-05-20 00:47:26 +02:00
Eric Kohl
9c8ef7369f [e1000][ne2000][pcnet][rtl8139] Add missing UpperRange and LowerRange values to network adapter inf files
These values will be used for binding network adapters to protocol drivers. Right now we use hard-coded binding.
2025-02-03 01:15:10 +01:00
Katayama Hirofumi MZ
0e327e9a70 [REACTOS] Follow-up of #7632; Revert 3rd-party changes
CORE-19963
2025-01-28 20:17:30 +09:00
Katayama Hirofumi MZ
fe11f7a2e5 [REACTOS] Refresh old URLs (#7632)
URLs are getting old. We have to
update URLs for documentation
purpose.
JIRA issue: CORE-19963
- Refresh old URLs.
- Add " (DEAD_LINK)" labels
  to dead links.
- Use MS Learn links rather
  than MSDN ones.
- Some dead links revived by
  Web Archive.
- Don't change Wine Tests
  and Wine Sync.
- Don't change 3rd party libraries.
- Don't append "redirected" labels.
2025-01-28 13:36:45 +09:00
Timo Kreuzer
0d6316b008 [CMAKE][LWIP] Fix build with newer CMake versions 2024-11-10 11:46:47 +02:00
Hervé Poussineau
d6eebaa47a [TCPIP] Synchronize LWIP code to 2.2.0
- take code from STABLE-2_2_0_RELEASE commit on https://git.savannah.gnu.org/git/lwip.git
- remove lwip/contrib directory
- do required changes due to upgrade in
  * CMakeLists.txt
  * include/lwip/arch/cc.h
  * include/lwip/arch/sys_arch.h
  * include/lwip/lwipopts.h
  * include/tcpip.h
  * ip/CMakeLists.txt
  * ip/lwip_glue/lwip_glue.h
  * ip/lwip_glue/tcp.c
  * ip/transport/tcp/if.c
  * tcpip/icmp.c

CORE-13098
2024-11-03 22:49:45 +01:00
Hervé Poussineau
bc94df7288 [TCPIP] Add ip_addr_t typedef
ip_addr_t is used in later versions of LWIP.
2024-11-03 22:49:45 +01:00
Hervé Poussineau
5e5b31ecbd [TCPIP] Remove options in lwipopts.h having default values
If lwipopts.h doesn't provide a define, a default value is taken from lwip/src/include/lwip/opt.h
2024-11-03 22:49:45 +01:00
Timo Kreuzer
0c2cdcae83 [REACTOS] Add missing line breaks at end of file 2024-10-06 10:47:11 +03:00
Joachim Henze
32d615fc10 [DD] Keep the network drivers infs 8.3 like on MS Windows (#7007)
Windows has all its network drivers inf files in 8.3.

This is an addendum to 0.4.15-dev-52-g 019f21ee1d
which moved us further away from our target.

The commit on its own was a good idea actually to get the inf into the drivers directory
and therefore simplifies adding and excluding drivers more locally (e.g. excluding works by
adding a single hashtag within the specific drivers CMakeLists.txt now).

But that cool feature doesn't require us to move away from our target.

For the record:
The historic netrtpnt.inf and netisa.inf (both 8.3) have been merged to
netne2000.inf (not 8.3) by 0.4.15-dev-2763-g 6924b8ff39
Unification of that was cool too,
but again: 8.3 is superior. Therefore netne.inf for that.

Worst of all: Since the .inf files did contain their filename within a comment also, that means
the historic renaming by the mentioned commit invalidated that comment.
netamd.inf fixed by restoring the ancient filename before 0.4.15-dev-52-g 019f21ee1d
netrtl.inf fixed by restoring the ancient filename before 0.4.15-dev-52-g 019f21ee1d
netne.inf I fixed the comment manually.
2024-06-17 22:41:31 +02:00
Joachim Henze
3e6f65ffcd [DC21X4] Fix uninitialized variable read (#6984)
This is the network driver which is used for MSVPC 2007.

I spotted it during a WIP-backport-experiment of the driver, when compiling with GCC4.7.2, which warned about it.
GCC8.4.0 unfortunately is blind to that on master head, for unknown reasons. Not good.
MSVC github buildbot is also blind to that on master head, for unknown reasons. Not good.
We later found that at least Clang did also warn about it on master head.
2024-06-13 21:24:23 +02:00
Dmitry Borisov
e6cd9de3f1 [DC21X4] Recognize all ports emulated by VPC 2007 (#6501) 2024-02-16 16:56:07 +01:00
Adam Słaboń
823fdb19d7 [SDK][VIRTIO][NETKVM] Make VirtIO a separate library (#6280)
* [SDK][VIRTIO][NETKVM] Make VirtIO a separate library

This is to avoid code duplication when more VirtIO drivers are brought in. This will also be used on development of a VirtIO XDDM GPU Driver.

* [VIRTIO] Sync with upstream
2024-01-16 17:55:35 -08:00
Hervé Poussineau
382836f087 [TCPIP] Remove code duplication to get max link speed, MTU and max packet size
This is already done when link goes up, in ReconfigureAdapter() function.
2024-01-13 15:23:46 +01:00
Hervé Poussineau
89b685007a [TCPIP] Call netif_set_link_up/netif_set_link_down after link status change
- Update TCP cached information only after updating adapter information
  (so that TCPUpdateInterfaceIPInformation/TCPUpdateInterfaceLinkStatus
  gets new status)
- Call netif_set_link_up/netif_set_link_down in TCPUpdateInterfaceLinkStatus

This fixes a lwIP requirement:
  2007-07-13 Jared Grubb (integrated by Frédéric Bernon)
  * [...] Be carefull for port maintainers to add the NETIF_FLAG_LINK_UP
    flag (like in ethernetif.c) if you want to be sure to be compatible with
    future changes...
2024-01-13 15:23:46 +01:00
Hervé Poussineau
3e3d34d97b [TCPIP] Get max link speed, MTU and max packet size when adapter is connected 2024-01-13 15:23:46 +01:00
hpoussin
9cfd8dd918 [LWIP] Correctly synchronize to lwIP 1.4.1 (#6123)
* [TCPIP] Rename lwip library to lwipcore

* [TCPIP] Remove ReactOS-specific code from LWIP library

* [TCPIP] Synchronize LWIP code to 1.4.1

Update to LWIP 1.4.1 should have been done by bd3b0e8ef4
However, I was unable to find the exact revision used in this commit.

So, do the following
- take code from STABLE-1_4_1 commit on https://git.savannah.gnu.org/git/lwip.git
- cherry-pick LWIP 32aa9a41e2013e5ee6eee09317a848647e37badf (CORE-8978)
- cherry-pick LWIP c0b534e5318baf870e2152c70d4d11a3a86181f3
- add a ReactOS-specific change in src/api/tcpip.c (missing include)
- add ReactOS specific file CMakeLists.txt

NOTE: Changes are mostly in unit test files (not used) and CHANGELOG file.

CORE-7140
2023-12-29 13:05:41 +01:00
Adam Słaboń
fcaa38c705 [NETKVM] Don't restrict driver setup to x86 builds (#6221) 2023-12-23 22:00:34 +01:00
Ratin Gao
ffb20d3330 [REACTOS] Fix typos (#6198)
- Adress -> Address
- Currupted -> Corrupted

3rd-party files are not modified.
2023-12-23 21:37:08 +01:00
Dmitry Borisov
bbe6b07612 [DC21X4] Fix minor issues (#6161)
- The return value got lost when refactoring the setup function
- The check against 0xFFFFFFFF was meant to reject an empty EEPROM image
- Add missing PAGED_CODE(); macros

CORE-8724
2023-12-17 12:00:25 +03:00
Hermès Bélusca-Maïto
c77a5ff99b Revert my last commits that break build.
Revert "[PSDK][AFD][VGADDI] Further build and MS PSDK compatibility fixes."
This reverts commit 99efc2ae50.

Revert "[PSDK] Sync winresrc.h with wine-8.20"
This reverts commit 3e83562aa7.

Revert "[OSK][PROGMAN] Fix resource file build."
This reverts commit 84e4ad0a82.

Revert "[PSDK] Use the new .rh files in winresrc.h"
This reverts commit f6fb7c48c9.
2023-11-23 17:20:47 +01:00
Hermès Bélusca-Maïto
99efc2ae50 [PSDK][AFD][VGADDI] Further build and MS PSDK compatibility fixes.
- windows.h:
  * should define _WINDOWS_ and _INC_WINDOWS instead of _WINDOWS_H
  * include winresrc.h if RC_INVOKED and not NOWINRES (Wine also agrees
    with that)
  * also, some .h included from there should _not_ be included if their
    respective NO*** flags are defined.

- batclass.h: Use correct _WINDOWS_ guard.

- winsnmp.h:
  * should define _INC_WINSNMP instead of _WINSNMP_H
  * use _INC_WINDOWS instead of _WINDOWS_H

- afd.h, vgaddi.h: Use the correct guards.

- winnt.rh: Define the (SUB)LANG_* exactly as they are in the winnt.h,
  otherwise we get macro redefinition compile errors.

NOTE: Ideally these .rh files should be auto-generated from their
corresponding .h files.

- afxres.h: Do not include the whole windows.h, but instead, only
  the winres.h file, and only if RC_INVOKED is defined.

NOTE: Both afxres.h and winres.h do not really belong to the PSDK,
but belong instead to MFC. The reason why we have them here is twofold:

1. Wine used to have also winres.h (from where we got ours). This is
   because the .rc resource files of some non-MFC modules were generated
   with Visual Studio, which always includes afxres.h for these, and the
   solution was to use a slightly less MFC-specific header: winres.h
   (Wine commit cb08c82244673f26842e7a0766de90f091b5a493).
   However, this winres.h has been since removed from Wine tree
   (Wine commit 197f4059ab2af5f13f9c56faa26e3b4af902f869).

2. Few of our modules either use afxres.h or winres.h in their resource
   files, and we still want to be able to compile them.
2023-11-23 16:26:30 +01:00
Stanislav Motylkov
0af84ce12d [NVNET] Remove NdisEqualMemory hack by linking with memcmp library
Fix suggested by Hermès Bélusca-Maïto. CORE-15872
2023-10-18 20:18:02 +03:00