Select frontend network callbacks for auto_sockets=android instead of opening a denied netlink monitor. Preserve monitor descriptor ownership, keep native monitoring failures fatal, and release caller config on failed Android core creation and restart. Register ConnectivityManager before requesting startup, report readiness after SERVICE_STARTED, and refresh addresses after initialization with serialized updates and generation checks. Add regression coverage for denied netlink, socket failures, address updates, and fd=0 preservation. Record the separate cancellation issue for startup before readiness. Validation: full check.sh passed, including proxy/burst/load integrations. Clean Android build installed successfully on SM-A525F and Q8; logcat confirms both cores initialized and entered the poll loop with external monitoring and post-start address refresh.
27 lines
1.3 KiB
C
27 lines
1.3 KiB
C
/* socket_monitor — наблюдение за адресами интерфейсов и маршрутами ОС для ETCP-сокетов.
|
||
* init подключает уведомления ОС к uasync экземпляра; изменения обновляют interface_addr и сетевое состояние.
|
||
* auto_socket отдельно создаёт/удаляет сокеты. destroy отключает наблюдение до освобождения экземпляра.
|
||
* Публичные операции и изменения ETCP_SOCKET — в потоке uasync. */
|
||
#ifndef SOCKET_MONITOR_H
|
||
#define SOCKET_MONITOR_H
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
struct UTUN_INSTANCE;
|
||
struct ETCP_SOCKET;
|
||
|
||
/* В режиме auto_sockets=android адресами управляет frontend; нативный монитор не создаётся. */
|
||
int socket_monitor_init(struct UTUN_INSTANCE* instance);
|
||
void socket_monitor_destroy(struct UTUN_INSTANCE* instance);
|
||
|
||
/* Обновляет interface_addr сокета (IP интерфейса / default route).
|
||
* Экспортирована для auto_socket — вызывается когда интерфейс получил новый адрес. */
|
||
void socket_monitor_update_if_addr(struct ETCP_SOCKET* es);
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
#endif
|