Signed-off-by: Felix Fietkau <nbd@nbd.name>
static pex_recv_control_cb_t pex_control_cb;
static int pex_unix_tx_fd = -1;
+int pex_socket(void)
+{
+ return pex_fd.fd;
+}
+
+int pex_raw_socket(int family)
+{
+ return family == AF_INET ? pex_raw_v4_fd : pex_raw_v6_fd;
+}
+
static const void *
get_mapped_sockaddr(const void *addr)
{
if (fd < 0) {
hdr->len -= sizeof(struct pex_ext_hdr);
if (ip_hdrlen)
- fd = sa->sa_family == AF_INET6 ? pex_raw_v6_fd : pex_raw_v4_fd;
+ fd = pex_raw_socket(sa->sa_family);
else {
fd = pex_fd.fd;
sa = addr = get_mapped_sockaddr(addr);
int pex_unix_open(const char *path, pex_recv_control_cb_t cb);
void pex_close(void);
+int pex_socket(void);
+int pex_raw_socket(int family);
uint64_t pex_network_hash(const uint8_t *auth_key, uint64_t req_id);
struct pex_hdr *__pex_msg_init(const uint8_t *pubkey, uint8_t opcode);
struct pex_hdr *__pex_msg_init_ext(const uint8_t *pubkey, const uint8_t *auth_key,