mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 12:33:02 +02:00
confd: drop leading ietf/infix prefix in source files
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+27
-27
@@ -26,36 +26,36 @@ confd_plugin_la_SOURCES = \
|
||||
base64.c base64.h \
|
||||
core.c core.h \
|
||||
dagger.c dagger.h \
|
||||
ietf-interfaces.c ietf-interfaces.h \
|
||||
interfaces.c interfaces.h \
|
||||
ieee802-ethernet-interface.c \
|
||||
ietf-ip.c \
|
||||
infix-if-bridge.c \
|
||||
infix-if-lag.c \
|
||||
infix-if-bridge-mcd.c \
|
||||
infix-if-bridge-port.c \
|
||||
infix-if-veth.c \
|
||||
infix-if-vlan.c \
|
||||
infix-if-gre.c \
|
||||
infix-if-vxlan.c \
|
||||
infix-if-wifi.c \
|
||||
ietf-keystore.c \
|
||||
ietf-system.c \
|
||||
ietf-syslog.c \
|
||||
ietf-factory-default.c \
|
||||
ietf-routing.c \
|
||||
infix-dhcp-common.c \
|
||||
infix-dhcp-client.c \
|
||||
infix-dhcpv6-client.c \
|
||||
infix-dhcp-server.c \
|
||||
infix-factory.c \
|
||||
infix-firewall.c \
|
||||
infix-meta.c \
|
||||
infix-services.c \
|
||||
infix-system-software.c \
|
||||
ietf-hardware.c
|
||||
ip.c \
|
||||
if-bridge.c \
|
||||
if-lag.c \
|
||||
if-bridge-mcd.c \
|
||||
if-bridge-port.c \
|
||||
if-veth.c \
|
||||
if-vlan.c \
|
||||
if-gre.c \
|
||||
if-vxlan.c \
|
||||
if-wifi.c \
|
||||
keystore.c \
|
||||
system.c \
|
||||
syslog.c \
|
||||
factory-default.c \
|
||||
routing.c \
|
||||
dhcp-common.c \
|
||||
dhcp-client.c \
|
||||
dhcpv6-client.c \
|
||||
dhcp-server.c \
|
||||
factory.c \
|
||||
firewall.c \
|
||||
meta.c \
|
||||
services.c \
|
||||
system-software.c \
|
||||
hardware.c
|
||||
|
||||
if CONTAINERS
|
||||
confd_plugin_la_SOURCES += infix-containers.c cni.c cni.h
|
||||
confd_plugin_la_SOURCES += containers.c cni.c cni.h
|
||||
endif
|
||||
|
||||
rauc_installer_sources = \
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "core.h"
|
||||
#include "cni.h"
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
#define CNI_NAME "/etc/cni/net.d/%s.conflist"
|
||||
|
||||
|
||||
+14
-14
@@ -183,19 +183,19 @@ static inline int register_rpc(sr_session_ctx_t *session, const char *xpath,
|
||||
}
|
||||
|
||||
|
||||
/* ietf-interfaces.c */
|
||||
/* interfaces.c */
|
||||
int ietf_interfaces_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
int ietf_interfaces_cand_init(struct confd *confd);
|
||||
|
||||
/* ietf-syslog.c */
|
||||
/* syslog.c */
|
||||
int ietf_syslog_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* ietf-system.c */
|
||||
/* system.c */
|
||||
int ietf_system_rpc_init (struct confd *confd);
|
||||
int hostnamefmt (struct confd *confd, const char *fmt, char *hostnm, size_t hostlen, char *domain, size_t domlen);
|
||||
int ietf_system_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* infix-containers.c */
|
||||
/* containers.c */
|
||||
#ifdef CONTAINERS
|
||||
int infix_containers_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
int infix_containers_rpc_init(struct confd *confd);
|
||||
@@ -204,13 +204,13 @@ static inline int infix_containers_rpc_init(struct confd *confd) { return 0; }
|
||||
static inline int infix_containers_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd) { return 0; }
|
||||
#endif
|
||||
|
||||
/* infix-dhcp-client.c */
|
||||
/* dhcp-client.c */
|
||||
int infix_dhcp_client_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* infix-dhcpv6-client.c */
|
||||
/* dhcpv6-client.c */
|
||||
int infix_dhcpv6_client_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* infix-dhcp-server.c */
|
||||
/* dhcp-server.c */
|
||||
int infix_dhcp_server_candidate_init(struct confd *confd);
|
||||
int infix_dhcp_server_rpc_init(struct confd *confd);
|
||||
int infix_dhcp_server_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
@@ -218,31 +218,31 @@ int infix_dhcp_server_change(sr_session_ctx_t *session, struct lyd_node *config,
|
||||
/* ietf-routing */
|
||||
int ietf_routing_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* infix-factory.c */
|
||||
/* factory.c */
|
||||
int infix_factory_rpc_init(struct confd *confd);
|
||||
|
||||
/* ietf-factory-default */
|
||||
int ietf_factory_default_rpc_init(struct confd *confd);
|
||||
|
||||
/* infix-meta.c */
|
||||
/* meta.c */
|
||||
int infix_meta_change_cb(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* infix-system-software.c */
|
||||
/* system-software.c */
|
||||
int infix_system_sw_rpc_init(struct confd *confd);
|
||||
|
||||
/* infix-services.c */
|
||||
/* services.c */
|
||||
int infix_services_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* ietf-hardware.c */
|
||||
/* hardware.c */
|
||||
int ietf_hardware_candidate_init(struct confd *confd);
|
||||
int ietf_hardware_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* ietf-keystore.c */
|
||||
/* keystore.c */
|
||||
#define SSH_HOSTKEYS "/etc/ssh/hostkeys"
|
||||
#define SSH_HOSTKEYS_NEXT SSH_HOSTKEYS"+"
|
||||
int ietf_keystore_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* infix-firewall.c */
|
||||
/* firewall.c */
|
||||
int infix_firewall_rpc_init(struct confd *confd);
|
||||
int infix_firewall_candidate_init(struct confd *confd);
|
||||
int infix_firewall_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "infix-dhcp-common.h"
|
||||
#include "dhcp-common.h"
|
||||
|
||||
#define ARPING_MSEC 1000
|
||||
#define MODULE "infix-dhcp-client"
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <libyang/libyang.h>
|
||||
#include "core.h"
|
||||
#include "infix-dhcp-common.h"
|
||||
#include "dhcp-common.h"
|
||||
|
||||
int dhcp_option_lookup(const struct lyd_node *id)
|
||||
{
|
||||
@@ -230,7 +230,7 @@ static void infer_options_v6(sr_session_ctx_t *session, const char *xpath)
|
||||
}
|
||||
|
||||
/*
|
||||
* Called from ietf-interfaces.c ifchange_cand() to infer DHCP options
|
||||
* Called from interfaces.c ifchange_cand() to infer DHCP options
|
||||
* for both DHCPv4 and DHCPv6 client configurations
|
||||
*/
|
||||
int ifchange_cand_infer_dhcp(sr_session_ctx_t *session, const char *xpath)
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "infix-dhcp-common.h"
|
||||
#include "dhcp-common.h"
|
||||
|
||||
#define MODULE "infix-dhcp-server"
|
||||
#define ROOT_XPATH "/infix-dhcp-server:"
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "infix-dhcp-common.h"
|
||||
#include "dhcp-common.h"
|
||||
|
||||
#define MODULE "infix-dhcpv6-client"
|
||||
#define XPATH "/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/infix-dhcpv6-client:dhcp"
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <libyang/libyang.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
#define MODULE "infix-firewall"
|
||||
#define XPATH "/infix-firewall:firewall"
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
static bool iface_uses_autoneg(struct lyd_node *cif)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
static int gen_vlan(struct lyd_node *cif, struct lyd_node *vlan, FILE *conf)
|
||||
{
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
static const char *mstpd_cost_str(struct lyd_node *cost)
|
||||
{
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
struct ixif_br {
|
||||
const char *name;
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
#include <srx/lyx.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
int gre_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip)
|
||||
{
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
/*
|
||||
* The lag-port noode is only in the dif at initial creation, or removal.
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
/*
|
||||
* While the kernel atomically creates/destroys the pair, in `running`
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
int ifchange_cand_infer_vlan(sr_session_ctx_t *session, const char *path)
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
#include <srx/lyx.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
int vxlan_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip)
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
#include <srx/lyx.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
#define WPA_SUPPLICANT_FINIT_CONF "/etc/finit.d/available/wpa_supplicant-%s.conf"
|
||||
#define WPA_SUPPLICANT_CONF "/etc/wpa_supplicant-%s.conf"
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <srx/srx_val.h>
|
||||
#include <libyang/libyang.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
#define IFACE_PROBE_TIMEOUT 40
|
||||
|
||||
|
||||
@@ -99,12 +99,12 @@ bool iface_has_quirk(const char *ifname, const char *quirkname);
|
||||
/* ieee802-ethernet-interface.c */
|
||||
int netdag_gen_ethtool(struct dagger *net, struct lyd_node *cif, struct lyd_node *dif);
|
||||
|
||||
/* ietf-interfaces.c */
|
||||
/* interfaces.c */
|
||||
const char *get_chassis_addr(void);
|
||||
int link_gen_address(struct lyd_node *cif, FILE *ip);
|
||||
int ietf_interfaces_get_all_l3(const struct lyd_node *tree, char ***ifaces);
|
||||
|
||||
/* ietf-ip.c */
|
||||
/* ip.c */
|
||||
int netdag_gen_ipv6_autoconf(struct dagger *net, struct lyd_node *cif,
|
||||
struct lyd_node *dif, FILE *ip);
|
||||
int netdag_gen_ipv4_autoconf(struct dagger *net, struct lyd_node *cif,
|
||||
@@ -112,42 +112,42 @@ int netdag_gen_ipv4_autoconf(struct dagger *net, struct lyd_node *cif,
|
||||
int netdag_gen_ip_addrs(struct dagger *net, FILE *ip, const char *proto,
|
||||
struct lyd_node *cif, struct lyd_node *dif);
|
||||
|
||||
/* infix-if-bridge.c */
|
||||
/* if-bridge.c */
|
||||
int bridge_mstpd_gen(struct lyd_node *cifs);
|
||||
int bridge_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip, int add);
|
||||
int bridge_add_deps(struct lyd_node *cif);
|
||||
/* infix-if-bridge-mcd.c */
|
||||
/* if-bridge-mcd.c */
|
||||
int bridge_mcd_gen(struct lyd_node *cifs);
|
||||
/* infix-if-bridge-port.c */
|
||||
/* if-bridge-port.c */
|
||||
int bridge_port_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip);
|
||||
|
||||
/* infix-if-wifi.c */
|
||||
/* if-wifi.c */
|
||||
int wifi_gen(struct lyd_node *dif, struct lyd_node *cif, struct dagger *net);
|
||||
int wifi_gen_del(struct lyd_node *dif, struct dagger *net);
|
||||
|
||||
/* infix-if-gre.c */
|
||||
/* if-gre.c */
|
||||
int gre_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip);
|
||||
|
||||
/* infix-if-lag.c */
|
||||
/* if-lag.c */
|
||||
int lag_port_gen(struct lyd_node *dif, struct lyd_node *cif);
|
||||
int lag_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip, int add);
|
||||
int lag_add_deps(struct lyd_node *cif);
|
||||
|
||||
/* infix-if-veth.c */
|
||||
/* if-veth.c */
|
||||
bool veth_is_primary(struct lyd_node *cif);
|
||||
int ifchange_cand_infer_veth(sr_session_ctx_t *session, const char *path);
|
||||
int veth_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip);
|
||||
int veth_add_deps(struct lyd_node *cif);
|
||||
|
||||
/* infix-if-vlan.c */
|
||||
/* if-vlan.c */
|
||||
int ifchange_cand_infer_vlan(sr_session_ctx_t *session, const char *path);
|
||||
int vlan_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip);
|
||||
int vlan_add_deps(struct lyd_node *cif);
|
||||
|
||||
/* infix-dhcp-common.c */
|
||||
/* dhcp-common.c */
|
||||
int ifchange_cand_infer_dhcp(sr_session_ctx_t *session, const char *path);
|
||||
|
||||
/* infix-if-vxlan.c */
|
||||
/* if-vxlan.c */
|
||||
int vxlan_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip);
|
||||
|
||||
#endif /* CONFD_IETF_INTERFACES_H_ */
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
int netdag_gen_ipv6_autoconf(struct dagger *net, struct lyd_node *cif,
|
||||
struct lyd_node *dif, FILE *ip)
|
||||
@@ -0,0 +1,156 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <net/if.h> /* IFNAMSIZ */
|
||||
#include <sys/socket.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <poll.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define NL_BUFSZ 4096
|
||||
|
||||
#define dbg(fmt, args...) if (nl_debug) warnx(fmt, ##args)
|
||||
#define log(fmt, args...) warnx(fmt, ##args)
|
||||
|
||||
static int nl_debug;
|
||||
static char *nl_buf;
|
||||
|
||||
static void scpy(char *dst, const char *src, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (src[i] == 0)
|
||||
break;
|
||||
dst[i] = src[i];
|
||||
}
|
||||
|
||||
if (i < len)
|
||||
dst[i] = 0;
|
||||
else
|
||||
dst[len - 1] = 0;
|
||||
}
|
||||
|
||||
static int nlmsg_validate(struct nlmsghdr *nlmsg, ssize_t len)
|
||||
{
|
||||
ssize_t la;
|
||||
|
||||
if (nlmsg->nlmsg_len < NLMSG_LENGTH(sizeof(struct ifinfomsg)))
|
||||
return - 1; /* Packet too small or truncated! */
|
||||
|
||||
la = NLMSG_PAYLOAD(nlmsg, sizeof(struct ifinfomsg));
|
||||
if (la >= len)
|
||||
return -1; /* Packet too large! */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nl_link(struct nlmsghdr *nlmsg, ssize_t len)
|
||||
{
|
||||
char ifname[IFNAMSIZ];
|
||||
struct ifinfomsg *i;
|
||||
struct rtattr *a;
|
||||
ssize_t la;
|
||||
|
||||
i = NLMSG_DATA(nlmsg);
|
||||
a = (struct rtattr *)((char *)i + NLMSG_ALIGN(sizeof(struct ifinfomsg)));
|
||||
la = NLMSG_PAYLOAD(nlmsg, sizeof(struct ifinfomsg));
|
||||
|
||||
for (; RTA_OK(a, la); a = RTA_NEXT(a, la)) {
|
||||
if (a->rta_type != IFLA_IFNAME)
|
||||
continue;
|
||||
|
||||
scpy(ifname, RTA_DATA(a), sizeof(ifname));
|
||||
|
||||
switch (nlmsg->nlmsg_type) {
|
||||
case RTM_NEWLINK:
|
||||
dbg("%s: new link or IFF change, flags 0x%x, change 0x%x", ifname, i->ifi_flags, i->ifi_change);
|
||||
return 1;
|
||||
case RTM_DELLINK:
|
||||
dbg("%s: delete link", ifname);
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nl_callback(int sd)
|
||||
{
|
||||
while (1) {
|
||||
struct nlmsghdr *nh;
|
||||
ssize_t len;
|
||||
size_t l;
|
||||
|
||||
while ((len = recv(sd, nl_buf, NL_BUFSZ, 0)) < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
l = (size_t)len;
|
||||
for (nh = (struct nlmsghdr *)nl_buf; NLMSG_OK(nh, l); nh = NLMSG_NEXT(nh, l)) {
|
||||
switch (nh->nlmsg_type) {
|
||||
case RTM_NEWLINK:
|
||||
case RTM_DELLINK:
|
||||
if (nlmsg_validate(nh, len))
|
||||
continue;
|
||||
return nl_link(nh, len);
|
||||
case NLMSG_DONE:
|
||||
case NLMSG_ERROR:
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct sockaddr_nl sa = { 0 };
|
||||
struct pollfd pfd;
|
||||
int sd;
|
||||
|
||||
sd = socket(AF_NETLINK, SOCK_RAW | SOCK_NONBLOCK | SOCK_CLOEXEC, NETLINK_ROUTE);
|
||||
if (sd < 0)
|
||||
err(1, "socket()");
|
||||
|
||||
sa.nl_family = AF_NETLINK;
|
||||
sa.nl_groups = RTMGRP_IPV4_ROUTE | RTMGRP_LINK;
|
||||
sa.nl_pid = getpid();
|
||||
|
||||
if (bind(sd, (struct sockaddr *)&sa, sizeof(sa)) < 0)
|
||||
err(1, "bind()");
|
||||
|
||||
nl_buf = malloc(NL_BUFSZ);
|
||||
if (!nl_buf)
|
||||
err(1, "malloc()");
|
||||
|
||||
pfd.fd = sd;
|
||||
pfd.events = POLLIN;
|
||||
while (1) {
|
||||
int rc;
|
||||
|
||||
rc = poll(&pfd, 1, -1);
|
||||
if (rc == -1)
|
||||
break;
|
||||
|
||||
if (nl_callback(sd))
|
||||
log("link change");
|
||||
}
|
||||
|
||||
return !!close(sd);
|
||||
}
|
||||
Reference in New Issue
Block a user