X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-autoipd%2Fmain.c;h=d4b9b6deb0ab292afb6579e983c07aa7334d512e;hb=58ee9d8c85293eefa1e901c660fb30bf2b9122c8;hp=3271d83e8f6f0af56f2d1dbe4ff411e85f481d80;hpb=b54a67fe8a7da842fd086a289e5b61c5b518b03e;p=catta diff --git a/avahi-autoipd/main.c b/avahi-autoipd/main.c index 3271d83..d4b9b6d 100644 --- a/avahi-autoipd/main.c +++ b/avahi-autoipd/main.c @@ -62,6 +62,12 @@ #ifndef __linux__ #include + +/* Old versions of PCAP defined it as D_IN */ +#ifndef PCAP_D_IN +#define PCAP_D_IN D_IN +#endif + #endif #include @@ -77,6 +83,8 @@ #include "main.h" #include "iface.h" + + /* An implementation of RFC 3927 */ /* Constants from the RFC */ @@ -510,7 +518,7 @@ static int send_packet(int fd, int iface, ArpPacket *packet, size_t packet_len) sa.sll_halen = ETHER_ADDRLEN; memset(sa.sll_addr, 0xFF, ETHER_ADDRLEN); - if (sendto(fd, packet, packet_len, 0, (struct sockaddr*) &sa, sizeof(sa)) < 0) { + if (sendto(fd, packet->ether_payload, packet_len, 0, (struct sockaddr*) &sa, sizeof(sa)) < 0) { daemon_log(LOG_ERR, "sendto() failed: %s", strerror(errno)); return -1; } @@ -1003,7 +1011,7 @@ static int drop_privs(void) { #elif defined(HAVE_SETREGID) r = setregid(gr->gr_gid, gr->gr_gid); #else -#error "No API to drop priviliges" +#error "No API to drop privileges" #endif if (r < 0) { @@ -1019,7 +1027,7 @@ static int drop_privs(void) { #elif defined(HAVE_SETREUID) r = setreuid(pw->pw_uid, pw->pw_uid); #else -#error "No API to drop priviliges" +#error "No API to drop privileges" #endif if (r < 0) { @@ -1042,7 +1050,7 @@ static int loop(int iface, uint32_t addr) { FD_ARP, FD_IFACE, FD_SIGNAL, - FD_MAX, + FD_MAX }; int fd = -1, ret = -1; @@ -1208,13 +1216,13 @@ static int loop(int iface, uint32_t addr) { if (info.sender_ip_address == addr) { /* Normal conflict */ conflict = 1; - daemon_log(LOG_INFO, "Recieved conflicting normal ARP packet."); + daemon_log(LOG_INFO, "Received conflicting normal ARP packet."); } else if (state == STATE_WAITING_PROBE || state == STATE_PROBING || state == STATE_WAITING_ANNOUNCE) { /* Probe conflict */ conflict = info.target_ip_address == addr && memcmp(hw_address, info.sender_hw_address, ETHER_ADDRLEN); if (conflict) - daemon_log(LOG_INFO, "Recieved conflicting probe ARP packet."); + daemon_log(LOG_INFO, "Received conflicting probe ARP packet."); } if (conflict) { @@ -1418,13 +1426,13 @@ static void help(FILE *f, const char *a0) { " -D --daemonize Daemonize after startup\n" " -s --syslog Write log messages to syslog(3) instead of STDERR\n" " -k --kill Kill a running daemon\n" - " -r --refresh Request a running daemon to refresh it's IP address\n" + " -r --refresh Request a running daemon refresh its IP address\n" " -c --check Return 0 if a daemon is already running\n" " -V --version Show version\n" " -S --start=ADDRESS Start with this address from the IPv4LL range\n" " 169.254.0.0/16\n" " -t --script=script Action script to run (defaults to\n" - " /etc/avahi/avahi-autoipd.action)\n" + " "AVAHI_IPCONF_SCRIPT")\n" " -w --wait Wait until an address has been acquired before\n" " daemonizing\n" " --force-bind Assign an IPv4LL address even if a routable address\n"