mirror of
https://github.com/akuker/RASCSI.git
synced 2026-10-25 12:02:59 +00:00
Refactor the DaynaPort TAP driver around explicit bridge and proxy-ARP profiles. Validate the selected interface and profile before creating piscsi0, attach it only to the preconfigured bridge when appropriate, derive a stable DaynaPort MAC address from the uplink, and make TAP setup and cleanup robust. Add managed host networking profiles for wired bridging and Wi-Fi proxy ARP. Install the PiSCSI NetworkManager templates, profile-management command, parprouted and DHCP relay system services, udev/sysctl hooks, and configuration file so a selected Wi-Fi uplink can provide proxy-ARP networking without altering connectivity during package installation. Expose DaynaPort profiles consistently through the protocol, daemon, scsictl, and web UI. Report interface type, state, and supported modes; require or default explicit mode/interface pairs on attach; present eligible wired-bridge and Wi-Fi proxy-ARP choices; and validate selections before attaching an SCDP device. Package and document the new networking workflow. Add the profile utility and required runtime assets to Debian packages, expand the manual-page set and web manual index, update DaynaPort command help, and extend unit and handler tests for the profile-aware behavior.
55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2023 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <set>
|
|
#include <map>
|
|
#include <optional>
|
|
#include <filesystem>
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
using namespace std;
|
|
|
|
struct sockaddr_in;
|
|
|
|
namespace network_util
|
|
{
|
|
enum class NetworkInterfaceType {
|
|
UNKNOWN,
|
|
LOOPBACK,
|
|
BRIDGE,
|
|
ETHERNET,
|
|
WIFI,
|
|
TAP,
|
|
VIRTUAL,
|
|
};
|
|
|
|
struct NetworkInterfaceInfo {
|
|
string name;
|
|
NetworkInterfaceType type = NetworkInterfaceType::UNKNOWN;
|
|
bool up = false;
|
|
};
|
|
|
|
using network_interface_map = map<string, NetworkInterfaceInfo, less<>>;
|
|
|
|
bool IsInterfaceUp(const string&);
|
|
bool IsValidInterfaceName(const string&);
|
|
vector<uint8_t> GetMacAddress(const string&);
|
|
optional<string> ParseProxyArpUplink(const string&);
|
|
optional<string> ReadProxyArpUplinkFile(const filesystem::path&);
|
|
optional<string> GetConfiguredProxyArpUplink();
|
|
NetworkInterfaceType ClassifyInterface(bool, bool, bool, bool, const string&);
|
|
network_interface_map GetNetworkInterfaceInfo();
|
|
set<string, less<>> GetNetworkInterfaces();
|
|
bool ResolveHostName(const string&, sockaddr_in *);
|
|
}
|