From a6fa2367008b3c0c5a0c526a3a92924f88a44182 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Wed, 30 Mar 2011 23:59:22 -0400 Subject: [PATCH] Massive cosmetic patch: update or add copyright headers, untabify, and change all unsigned char to uint8_t. --- ndhc/arp.c | 18 +++++++++-- ndhc/arp.h | 23 ++++++++++++++ ndhc/dhcpmsg.c | 13 ++++---- ndhc/dhcpmsg.h | 41 ++++++++++++++++++------- ndhc/ndhc.c | 12 ++++---- ndhc/netlink.c | 24 +++++++++++---- ndhc/netlink.h | 22 ++++++++++++++ ndhc/packet.c | 81 +++++++++++++++++++++++++++++++------------------- ndhc/packet.h | 29 +++++++++++++++--- ndhc/socket.c | 18 +++-------- ndhc/socket.h | 20 +++++++++++++ ndhc/sys.c | 21 ++++++++++++- ndhc/sys.h | 20 +++++++++++++ ndhc/timeout.c | 21 ++++++++++++- ndhc/timeout.h | 20 +++++++++++++ 15 files changed, 300 insertions(+), 83 deletions(-) diff --git a/ndhc/arp.c b/ndhc/arp.c index 5b34a4e..1c3af62 100644 --- a/ndhc/arp.c +++ b/ndhc/arp.c @@ -1,13 +1,25 @@ /* arp.c - arp ping checking + * Time-stamp: <2011-03-30 23:34:21 nk> + * * Copyright 2010-2011 Nicholas J. Kain * * Originally derived from busybox's udhcpc variant, which in turn was... * Mostly stolen from: dhcpcd - DHCP client daemon * by Yoichi Hariguchi * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include diff --git a/ndhc/arp.h b/ndhc/arp.h index 7dbd54f..41d6a3d 100644 --- a/ndhc/arp.h +++ b/ndhc/arp.h @@ -1,3 +1,26 @@ +/* arp.h - functions to call the interface change daemon + * Time-stamp: <2011-03-30 23:36:45 nk> + * + * Copyright 2010-2011 Nicholas J. Kain + * + * Originally derived from busybox's udhcpc variant, which in turn was... + * Mostly stolen from: dhcpcd - DHCP client daemon + * by Yoichi Hariguchi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #ifndef ARPPING_H_ #define ARPPING_H_ diff --git a/ndhc/dhcpmsg.c b/ndhc/dhcpmsg.c index d4d3bfe..42a4749 100644 --- a/ndhc/dhcpmsg.c +++ b/ndhc/dhcpmsg.c @@ -1,9 +1,8 @@ -/* dhcpmsg.c +/* dhcpmsg.c - dhcp packet generation and sending functions + * Time-stamp: <2011-03-30 23:57:43 nk> * - * Packet generation and dispatching functions for the DHCP client. - * - * Nicholas J. Kain 2004-2010 - * Russ Dill July 2001 + * (c) 2004-2011 Nicholas J. Kain + * (c) 2001 Russ Dill * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,10 +99,10 @@ static void init_packet(struct dhcpMessage *packet, char type) add_option_string(packet->options, DHCP_OPTIONS_BUFSIZE, client_config.hostname); add_option_string(packet->options, DHCP_OPTIONS_BUFSIZE, - (unsigned char *)&vendor_id); + (uint8_t *)&vendor_id); } -#define MAC_BCAST_ADDR (unsigned char *) "\xff\xff\xff\xff\xff\xff" +#define MAC_BCAST_ADDR (uint8_t *)"\xff\xff\xff\xff\xff\xff" /* Wrapper that broadcasts a raw dhcp packet on the bound interface. */ static int bcast_raw_packet(struct dhcpMessage *packet) { diff --git a/ndhc/dhcpmsg.h b/ndhc/dhcpmsg.h index f5ed50a..f3ce96b 100644 --- a/ndhc/dhcpmsg.h +++ b/ndhc/dhcpmsg.h @@ -1,8 +1,29 @@ -#ifndef CLIENTPACKET_H_ -#define CLIENTPACKET_H_ +/* dhcpmsg.c - dhcp packet generation and sending functions + * Time-stamp: <2011-03-30 23:53:52 nk> + * + * (c) 2004-2011 Nicholas J. Kain + * (c) 2001 Russ Dill + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef DHCPMSG_H_ +#define DHCPMSG_H_ #include -#include "packet.h" // for struct dhcpMessage +#include "packet.h" #define DHCP_SERVER_PORT 67 #define DHCP_CLIENT_PORT 68 @@ -10,13 +31,13 @@ enum { DHCPDISCOVER = 1, - DHCPOFFER = 2, - DHCPREQUEST = 3, - DHCPDECLINE = 4, - DHCPACK = 5, - DHCPNAK = 6, - DHCPRELEASE = 7, - DHCPINFORM = 8 + DHCPOFFER = 2, + DHCPREQUEST = 3, + DHCPDECLINE = 4, + DHCPACK = 5, + DHCPNAK = 6, + DHCPRELEASE = 7, + DHCPINFORM = 8 }; uint32_t random_xid(void); diff --git a/ndhc/ndhc.c b/ndhc/ndhc.c index 6e4f931..6f03ebe 100644 --- a/ndhc/ndhc.c +++ b/ndhc/ndhc.c @@ -1,9 +1,7 @@ -/* ndhc.c +/* ndhc.c - DHCP client + * Time-stamp: <2011-03-30 23:58:05 nk> * - * ndhc DHCP client, originally based on udhcpc - * - * Nicholas J. Kain 2004-2010 - * Russ Dill July 2001 + * (c) 2004-2011 Nicholas J. Kain * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -302,7 +300,7 @@ int main(int argc, char **argv) if (client_config.clientid) free(client_config.clientid); client_config.clientid = - alloc_dhcp_client_id_option(0, (unsigned char *)optarg, len); + alloc_dhcp_client_id_option(0, (uint8_t *)optarg, len); break; case 'f': client_config.foreground = 1; @@ -321,7 +319,7 @@ int main(int argc, char **argv) if (client_config.hostname) free(client_config.hostname); client_config.hostname = - alloc_option(DHCP_HOST_NAME, (unsigned char *)optarg, len); + alloc_option(DHCP_HOST_NAME, (uint8_t *)optarg, len); break; case 'i': client_config.interface = optarg; diff --git a/ndhc/netlink.c b/ndhc/netlink.c index 8a4b8c4..ab1f86a 100644 --- a/ndhc/netlink.c +++ b/ndhc/netlink.c @@ -1,11 +1,23 @@ -/* - * Copyright 2011 Nicholas J. Kain - * Copyright 2006, 2007 Stefan Rompf +/* netlink.c - netlink physical link notification handling and info retrieval * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation + * (c) 2011 Nicholas J. Kain + * (c) 2006-2007 Stefan Rompf * + * This code was largely taken from Stefan Rompf's dhcpclient. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/ndhc/netlink.h b/ndhc/netlink.h index a63c9df..57dae56 100644 --- a/ndhc/netlink.h +++ b/ndhc/netlink.h @@ -1,3 +1,25 @@ +/* netlink.h - netlink physical link notification handling and info retrieval + * + * (c) 2011 Nicholas J. Kain + * (c) 2006-2007 Stefan Rompf + * + * This code was largely taken from Stefan Rompf's dhcpclient. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #ifndef NK_NETLINK_H_ #define NK_NETLINK_H_ diff --git a/ndhc/packet.c b/ndhc/packet.c index 10bbbde..1dd93e2 100644 --- a/ndhc/packet.c +++ b/ndhc/packet.c @@ -1,3 +1,24 @@ +/* packet.c - send and react to DHCP message packets + * Time-stamp: <2011-03-30 23:57:14 nk> + * + * (c) 2004-2011 Nicholas J. Kain + * (c) 2001 Russ Dill + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #include #include #include @@ -27,13 +48,13 @@ int get_packet(struct dhcpMessage *packet, int fd) memset(packet, 0, DHCP_SIZE); bytes = safe_read(fd, (char *)packet, DHCP_SIZE); if (bytes == -1) { - log_line("Read on listen socket failed: %s", strerror(errno)); - return -1; + log_line("Read on listen socket failed: %s", strerror(errno)); + return -1; } if (ntohl(packet->cookie) != DHCP_MAGIC) { - log_error("Packet with bad magic number, ignoring."); - return -2; + log_error("Packet with bad magic number, ignoring."); + return -2; } log_line("Received a packet"); @@ -47,21 +68,21 @@ uint16_t checksum(void *addr, int count) uint16_t *source = (uint16_t *)addr; while (count > 1) { - sum += *source++; - count -= 2; + sum += *source++; + count -= 2; } /* Add left-over byte, if any */ if (count > 0) { - /* Make sure that the left-over byte is added correctly both - * with little and big endian hosts */ - uint16_t tmp = 0; - *(uint8_t *)&tmp = *(uint8_t *)source; - sum += tmp; + /* Make sure that the left-over byte is added correctly both + * with little and big endian hosts */ + uint16_t tmp = 0; + *(uint8_t *)&tmp = *(uint8_t *)source; + sum += tmp; } /* Fold 32-bit sum to 16 bits */ while (sum >> 16) - sum = (sum & 0xffff) + (sum >> 16); + sum = (sum & 0xffff) + (sum >> 16); return ~sum; } @@ -70,7 +91,7 @@ uint16_t checksum(void *addr, int count) * hardware address */ int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port, uint32_t dest_ip, int dest_port, - unsigned char *dest_arp, int ifindex) + uint8_t *dest_arp, int ifindex) { struct sockaddr_ll dest; struct ip_udp_dhcp_packet packet; @@ -78,8 +99,8 @@ int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, unsigned int padding; if ((fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))) < 0) { - log_error("raw_packet: socket failed: %s", strerror(errno)); - goto out; + log_error("raw_packet: socket failed: %s", strerror(errno)); + goto out; } memset(&dest, 0, sizeof dest); @@ -92,8 +113,8 @@ int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, dest.sll_halen = 6; memcpy(dest.sll_addr, dest_arp, 6); if (bind(fd, (struct sockaddr *)&dest, sizeof(struct sockaddr_ll)) < 0) { - log_error("raw_packet: bind failed: %s", strerror(errno)); - goto out_fd; + log_error("raw_packet: bind failed: %s", strerror(errno)); + goto out_fd; } /* We were sending full-sized DHCP packets (zero padded), @@ -131,9 +152,9 @@ int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, packet.ip.check = checksum(&packet.ip, sizeof packet.ip); r = safe_sendto(fd, (const char *)&packet, IP_UPD_DHCP_SIZE - padding, - 0, (struct sockaddr *)&dest, sizeof dest); + 0, (struct sockaddr *)&dest, sizeof dest); if (r == -1) - log_error("raw_packet: sendto failed: %s", strerror(errno)); + log_error("raw_packet: sendto failed: %s", strerror(errno)); out_fd: close(fd); out: @@ -142,17 +163,17 @@ int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, /* Let the kernel do all the work for packet generation */ int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, - int source_port, uint32_t dest_ip, int dest_port) + int source_port, uint32_t dest_ip, int dest_port) { struct sockaddr_in client; int opt = 1, fd, result = -1; unsigned int padding; if ((fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) - goto out; + goto out; if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof opt) == -1) - goto out_fd; + goto out_fd; memset(&client, 0, sizeof(client)); client.sin_family = AF_INET; @@ -160,7 +181,7 @@ int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, client.sin_addr.s_addr = source_ip; if (bind(fd, (struct sockaddr *)&client, sizeof(struct sockaddr)) == -1) - goto out_fd; + goto out_fd; memset(&client, 0, sizeof(client)); client.sin_family = AF_INET; @@ -168,7 +189,7 @@ int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, client.sin_addr.s_addr = dest_ip; if (connect(fd, (struct sockaddr *)&client, sizeof(struct sockaddr)) == -1) - goto out_fd; + goto out_fd; ssize_t endloc = get_end_option_idx(payload->options, DHCP_OPTIONS_BUFSIZE); @@ -179,7 +200,7 @@ int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, padding = DHCP_OPTIONS_BUFSIZE - 1 - endloc; result = safe_write(fd, (const char *)payload, DHCP_SIZE - padding); if (result == -1) - log_error("kernel_packet: write failed: %s", strerror(errno)); + log_error("kernel_packet: write failed: %s", strerror(errno)); out_fd: close(fd); out: @@ -216,9 +237,9 @@ void change_listen_mode(struct client_state_t *cs, int new_mode) static void init_selecting_packet(struct client_state_t *cs, struct dhcpMessage *packet, - unsigned char *message) + uint8_t *message) { - unsigned char *temp = NULL; + uint8_t *temp = NULL; ssize_t optlen; /* Must be a DHCPOFFER to one of our xid's */ if (*message == DHCPOFFER) { @@ -240,9 +261,9 @@ static void init_selecting_packet(struct client_state_t *cs, static void dhcp_ack_or_nak_packet(struct client_state_t *cs, struct dhcpMessage *packet, - unsigned char *message) + uint8_t *message) { - unsigned char *temp = NULL; + uint8_t *temp = NULL; ssize_t optlen; if (*message == DHCPACK) { if (!(temp = get_option_data(packet, DHCP_LEASE_TIME, &optlen))) { @@ -279,7 +300,7 @@ static void dhcp_ack_or_nak_packet(struct client_state_t *cs, void handle_packet(struct client_state_t *cs) { - unsigned char *message = NULL; + uint8_t *message = NULL; int len; struct dhcpMessage packet; ssize_t optlen; diff --git a/ndhc/packet.h b/ndhc/packet.h index 2913044..149fc77 100644 --- a/ndhc/packet.h +++ b/ndhc/packet.h @@ -1,3 +1,24 @@ +/* packet.h - send and react to DHCP message packets + * Time-stamp: <2011-03-30 23:57:02 nk> + * + * (c) 2004-2011 Nicholas J. Kain + * (c) 2001 Russ Dill + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #ifndef PACKET_H_ #define PACKET_H_ @@ -40,16 +61,16 @@ struct udp_dhcp_packet { }; enum { - IP_UPD_DHCP_SIZE = sizeof(struct ip_udp_dhcp_packet), - UPD_DHCP_SIZE = sizeof(struct udp_dhcp_packet), - DHCP_SIZE = sizeof(struct dhcpMessage), + IP_UPD_DHCP_SIZE = sizeof(struct ip_udp_dhcp_packet), + UPD_DHCP_SIZE = sizeof(struct udp_dhcp_packet), + DHCP_SIZE = sizeof(struct dhcpMessage), }; int get_packet(struct dhcpMessage *packet, int fd); uint16_t checksum(void *addr, int count); int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port, uint32_t dest_ip, int dest_port, - unsigned char *dest_arp, int ifindex); + uint8_t *dest_arp, int ifindex); int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port, uint32_t dest_ip, int dest_port); void change_listen_mode(struct client_state_t *cs, int new_mode); diff --git a/ndhc/socket.c b/ndhc/socket.c index 4b58f98..b8a3734 100644 --- a/ndhc/socket.c +++ b/ndhc/socket.c @@ -1,10 +1,8 @@ -/* - * socket.c -- DHCP server client/server socket creation +/* socket.c - raw and kernel socket creation functions + * Time-stamp: <2011-03-30 23:47:03 nk> * - * Copyright (C) 2004-2010 Nicholas J. Kain - * Rewrite by Russ Dill July 2001 - * Copyright (C) 1999 Matthew Ramsay - * Chris Trew + * (c) 2004-2011 Nicholas J. Kain + * Kernel BPF filter is (c) 2006, 2007 Stefan Rompf . * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -94,20 +92,12 @@ int raw_socket(int ifindex) /* * Comment: - * * I've selected not to see LL header, so BPF doesn't see it, too. * The filter may also pass non-IP and non-ARP packets, but we do * a more complete check when receiving the message in userspace. - * * and filter shamelessly stolen from: - * * http://www.flamewarmaster.de/software/dhcpclient/ * - * There are a few other interesting ideas on that page (look under - * "Motivation"). Use of netlink events is most interesting. Think - * of various network servers listening for events and reconfiguring. - * That would obsolete sending HUP signals and/or make use of restarts. - * * Copyright: 2006, 2007 Stefan Rompf . * License: GPL v2. */ diff --git a/ndhc/socket.h b/ndhc/socket.h index c28f396..e725f29 100644 --- a/ndhc/socket.h +++ b/ndhc/socket.h @@ -1,3 +1,23 @@ +/* socket.h - raw and kernel socket creation functions + * Time-stamp: <2011-03-30 23:47:34 nk> + * + * (c) 2004-2011 Nicholas J. Kain + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #ifndef SOCKET_H_ #define SOCKET_H_ diff --git a/ndhc/sys.c b/ndhc/sys.c index 1afca83..0f54d50 100644 --- a/ndhc/sys.c +++ b/ndhc/sys.c @@ -1,3 +1,23 @@ +/* sys.c - linux-specific signal and epoll functions + * Time-stamp: <2011-03-30 23:40:33 nk> + * + * (c) 2010-2011 Nicholas J. Kain + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #include #include #include @@ -72,4 +92,3 @@ void epoll_del(struct client_state_t *cs, int fd) if (r == -1) suicide("epoll_del failed %s", strerror(errno)); } - diff --git a/ndhc/sys.h b/ndhc/sys.h index 92c49d8..b228426 100644 --- a/ndhc/sys.h +++ b/ndhc/sys.h @@ -1,3 +1,23 @@ +/* sys.h - linux-specific signal and epoll functions + * Time-stamp: <2011-03-30 23:41:04 nk> + * + * (c) 2010-2011 Nicholas J. Kain + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #ifndef SYS_H_ #define SYS_H_ diff --git a/ndhc/timeout.c b/ndhc/timeout.c index a2c31d3..8f16462 100644 --- a/ndhc/timeout.c +++ b/ndhc/timeout.c @@ -1,3 +1,23 @@ +/* timeout.c - callbacks to react to event timeouts + * Time-stamp: <2011-03-30 23:42:13 nk> + * + * (c) 2004-2011 Nicholas J. Kain + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #include #include @@ -9,7 +29,6 @@ #include "arp.h" #include "log.h" - #define DELAY_SEC (((RETRY_DELAY - (RETRY_DELAY / NUMPACKETS)) / NUMPACKETS) + 1) static void init_selecting_timeout(struct client_state_t *cs) { diff --git a/ndhc/timeout.h b/ndhc/timeout.h index 51a0b31..7867f52 100644 --- a/ndhc/timeout.h +++ b/ndhc/timeout.h @@ -1,3 +1,23 @@ +/* timeout.h - callbacks to react to event timeouts + * Time-stamp: <2011-03-30 23:42:25 nk> + * + * (c) 2004-2011 Nicholas J. Kain + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #ifndef TIMEOUT_H_ #define TIMEOUT_H_