mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:42:43 +00:00 
			
		
		
		
	Kernel: Introduce the NetworkingManagement singleton
Instead of initializing network adapters in init.cpp, let's move that logic into a separate class to handle this. Also, it seems like a good idea to shift responsiblity on enumeration of network adapters after the boot process, so this singleton will take care of finding the appropriate network adapter when asked to with an IPv4 address or interface name. With this change being merged, we simplify the creation logic of NetworkAdapter derived classes, so we enumerate the PCI bus only once, searching for driver candidates when doing so, and we let each driver to test if it is resposible for the specified PCI device.
This commit is contained in:
		
							parent
							
								
									8b1d4d1b8e
								
							
						
					
					
						commit
						1c94b5e8eb
					
				
					 20 changed files with 212 additions and 117 deletions
				
			
		|  | @ -13,6 +13,7 @@ | |||
| #include <Kernel/Net/IPv4.h> | ||||
| #include <Kernel/Net/IPv4Socket.h> | ||||
| #include <Kernel/Net/NetworkAdapter.h> | ||||
| #include <Kernel/Net/NetworkingManagement.h> | ||||
| #include <Kernel/Net/Routing.h> | ||||
| #include <Kernel/Net/TCP.h> | ||||
| #include <Kernel/Net/TCPSocket.h> | ||||
|  | @ -582,7 +583,7 @@ int IPv4Socket::ioctl(FileDescription&, unsigned request, FlatPtr arg) | |||
|         if (copied_ifname.is_null()) | ||||
|             return -EFAULT; | ||||
| 
 | ||||
|         auto adapter = NetworkAdapter::lookup_by_name(copied_ifname); | ||||
|         auto adapter = NetworkingManagement::the().lookup_by_name(copied_ifname); | ||||
|         if (!adapter) | ||||
|             return -ENODEV; | ||||
| 
 | ||||
|  | @ -615,7 +616,7 @@ int IPv4Socket::ioctl(FileDescription&, unsigned request, FlatPtr arg) | |||
|         memcpy(namebuf, ifr.ifr_name, IFNAMSIZ); | ||||
|         namebuf[sizeof(namebuf) - 1] = '\0'; | ||||
| 
 | ||||
|         auto adapter = NetworkAdapter::lookup_by_name(namebuf); | ||||
|         auto adapter = NetworkingManagement::the().lookup_by_name(namebuf); | ||||
|         if (!adapter) | ||||
|             return -ENODEV; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A