avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
if ((fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) {
daemon_log(LOG_ERR, "socket(PF_NETLINK): %s", strerror(errno));
goto fail;
if ((fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) {
daemon_log(LOG_ERR, "socket(PF_NETLINK): %s", strerror(errno));
goto fail;
if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) {
daemon_log(LOG_ERR, "SO_PASSCRED: %s", strerror(errno));
goto fail;
}
ifindex = i;
if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) {
daemon_log(LOG_ERR, "SO_PASSCRED: %s", strerror(errno));
goto fail;
}
ifindex = i;
if (n->nlmsg_type == RTM_DELLINK) {
daemon_log(LOG_ERR, "Interface vanished.");
return -1;
}
assert(n->nlmsg_type == RTM_NEWLINK);
if (n->nlmsg_type == RTM_DELLINK) {
daemon_log(LOG_ERR, "Interface vanished.");
return -1;
}
assert(n->nlmsg_type == RTM_NEWLINK);
if ((ifi->ifi_flags & IFF_LOOPBACK) ||
(ifi->ifi_flags & IFF_NOARP) ||
ifi->ifi_type != ARPHRD_ETHER) {
if ((ifi->ifi_flags & IFF_LOOPBACK) ||
(ifi->ifi_flags & IFF_NOARP) ||
ifi->ifi_type != ARPHRD_ETHER) {
iov.iov_len = sizeof(replybuf);
memset(&msghdr, 0, sizeof(msghdr));
msghdr.msg_name = (void*) NULL;
iov.iov_len = sizeof(replybuf);
memset(&msghdr, 0, sizeof(msghdr));
msghdr.msg_name = (void*) NULL;
- msghdr.msg_namelen = 0;
- msghdr.msg_iov = &iov;
- msghdr.msg_iovlen = 1;
- msghdr.msg_control = cred_msg;
- msghdr.msg_controllen = sizeof(cred_msg);
+ msghdr.msg_namelen = 0;
+ msghdr.msg_iov = &iov;
+ msghdr.msg_iovlen = 1;
+ msghdr.msg_control = cred_msg;
+ msghdr.msg_controllen = sizeof(cred_msg);
if ((r = recvmsg(fd, &msghdr, 0)) < 0) {
daemon_log(LOG_ERR, "recvmsg() failed: %s", strerror(errno));
return -1;
}
if (!(cmsghdr = CMSG_FIRSTHDR(&msghdr)) || cmsghdr->cmsg_type != SCM_CREDENTIALS) {
if ((r = recvmsg(fd, &msghdr, 0)) < 0) {
daemon_log(LOG_ERR, "recvmsg() failed: %s", strerror(errno));
return -1;
}
if (!(cmsghdr = CMSG_FIRSTHDR(&msghdr)) || cmsghdr->cmsg_type != SCM_CREDENTIALS) {
for (; bytes > 0; p = NLMSG_NEXT(p, bytes)) {
if (!NLMSG_OK(p, bytes) || bytes < sizeof(struct nlmsghdr) || bytes < p->nlmsg_len) {
for (; bytes > 0; p = NLMSG_NEXT(p, bytes)) {
if (!NLMSG_OK(p, bytes) || bytes < sizeof(struct nlmsghdr) || bytes < p->nlmsg_len) {
memset(&req, 0, sizeof(req));
n = (struct nlmsghdr*) req;
n->nlmsg_len = NLMSG_LENGTH(sizeof(*ifi));
memset(&req, 0, sizeof(req));
n = (struct nlmsghdr*) req;
n->nlmsg_len = NLMSG_LENGTH(sizeof(*ifi));
if (send(fd, n, n->nlmsg_len, 0) < 0) {
daemon_log(LOG_ERR, "send(): %s", strerror(errno));
return -1;
if (send(fd, n, n->nlmsg_len, 0) < 0) {
daemon_log(LOG_ERR, "send(): %s", strerror(errno));
return -1;
*event = EVENT_ROUTABLE_ADDR_UNCONFIGURED;
else if (!b && addresses)
*event = EVENT_ROUTABLE_ADDR_CONFIGURED;
*event = EVENT_ROUTABLE_ADDR_UNCONFIGURED;
else if (!b && addresses)
*event = EVENT_ROUTABLE_ADDR_CONFIGURED;