Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/rarpd static + __printflike + __dead
details: https://anonhg.NetBSD.org/src/rev/2a300039aa6c
branches: trunk
changeset: 769057:2a300039aa6c
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Aug 30 20:25:18 2011 +0000
description:
static + __printflike + __dead
diffstat:
usr.sbin/rarpd/mkarp.c | 6 +-
usr.sbin/rarpd/rarpd.c | 79 ++++++++++++++++++++++++-------------------------
2 files changed, 41 insertions(+), 44 deletions(-)
diffs (246 lines):
diff -r eb0e2b0ebde9 -r 2a300039aa6c usr.sbin/rarpd/mkarp.c
--- a/usr.sbin/rarpd/mkarp.c Tue Aug 30 20:17:00 2011 +0000
+++ b/usr.sbin/rarpd/mkarp.c Tue Aug 30 20:25:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkarp.c,v 1.8 2009/04/18 08:50:23 lukem Exp $ */
+/* $NetBSD: mkarp.c,v 1.9 2011/08/30 20:25:18 joerg Exp $ */
/*
* Copyright (c) 1984, 1993
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)arp.c 8.3 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: mkarp.c,v 1.8 2009/04/18 08:50:23 lukem Exp $");
+__RCSID("$NetBSD: mkarp.c,v 1.9 2011/08/30 20:25:18 joerg Exp $");
#endif
#endif /* not lint */
@@ -82,7 +82,7 @@
int rtmsg(int, int, struct rt_msghdr *, struct sockaddr_inarp *,
struct sockaddr_dl *);
-struct {
+static struct {
struct rt_msghdr m_rtm;
char m_space[512];
} m_rtmsg;
diff -r eb0e2b0ebde9 -r 2a300039aa6c usr.sbin/rarpd/rarpd.c
--- a/usr.sbin/rarpd/rarpd.c Tue Aug 30 20:17:00 2011 +0000
+++ b/usr.sbin/rarpd/rarpd.c Tue Aug 30 20:25:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rarpd.c,v 1.58 2009/04/18 08:50:23 lukem Exp $ */
+/* $NetBSD: rarpd.c,v 1.59 2011/08/30 20:25:18 joerg Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -25,7 +25,7 @@
#endif /* not lint */
#ifndef lint
-__RCSID("$NetBSD: rarpd.c,v 1.58 2009/04/18 08:50:23 lukem Exp $");
+__RCSID("$NetBSD: rarpd.c,v 1.59 2011/08/30 20:25:18 joerg Exp $");
#endif
@@ -89,44 +89,41 @@
* The list of all interfaces that are being listened to. rarp_loop()
* "selects" on the descriptors in this list.
*/
-struct if_info *iflist;
+static struct if_info *iflist;
-u_int32_t choose_ipaddr(u_int32_t **, u_int32_t, u_int32_t);
-void debug(const char *,...)
- __attribute__((__format__(__printf__, 1, 2)));
-void init_some(char *name);
-void init_one(char *, u_int32_t);
-u_int32_t ipaddrtonetmask(u_int32_t);
-void lookup_eaddr(char *, u_char *);
-void lookup_ipaddr(char *, u_int32_t *, u_int32_t *);
-int main(int, char **);
-void rarp_loop(void);
-int rarp_open(char *);
-void rarp_process(struct if_info *, u_char *);
-void rarp_reply(struct if_info *, struct ether_header *, u_int32_t,
- struct hostent *);
-void rarperr(int, const char *,...)
- __attribute__((__format__(__printf__, 2, 3)));
+static u_int32_t choose_ipaddr(u_int32_t **, u_int32_t, u_int32_t);
+static void debug(const char *,...) __printflike(1, 2);
+static void init_some(char *name);
+static void init_one(char *, u_int32_t);
+static u_int32_t ipaddrtonetmask(u_int32_t);
+static void lookup_eaddr(char *, u_char *);
+static void lookup_ipaddr(char *, u_int32_t *, u_int32_t *);
+static void rarp_loop(void) __dead;
+static int rarp_open(char *);
+static void rarp_process(struct if_info *, u_char *);
+static void rarp_reply(struct if_info *, struct ether_header *, u_int32_t,
+ struct hostent *);
+static void rarperr(int, const char *,...) __printflike(2, 3);
#if defined(__NetBSD__)
#include "mkarp.h"
#else
-void update_arptab(u_char *, u_int32_t);
+static void update_arptab(u_char *, u_int32_t);
#endif
-void usage(void);
+__dead static void usage(void);
static int bpf_open(void);
static int rarp_check(u_char *, int);
#ifdef REQUIRE_TFTPBOOT
-int rarp_bootable(u_int32_t);
+static int rarp_bootable(u_int32_t);
#endif
-int aflag = 0; /* listen on "all" interfaces */
-int dflag = 0; /* print debugging messages */
-int fflag = 0; /* don't fork */
-int lflag = 0; /* log all replies */
+static int aflag = 0; /* listen on "all" interfaces */
+static int dflag = 0; /* print debugging messages */
+static int fflag = 0; /* don't fork */
+static int lflag = 0; /* log all replies */
int
main(int argc, char **argv)
@@ -189,7 +186,7 @@
* Add 'ifname' to the interface list. Lookup its IP address and network
* mask and Ethernet address, and open a BPF file for it.
*/
-void
+static void
init_one(char *ifname, u_int32_t ipaddr)
{
struct if_info *h;
@@ -237,7 +234,7 @@
* configuration list. A "candidate" is up, not loopback and not
* point to point.
*/
-void
+static void
init_some(char *name)
{
struct ifaddrs *ifap, *ifa, *p;
@@ -267,7 +264,7 @@
freeifaddrs(ifap);
}
-void
+static void
usage(void)
{
(void) fprintf(stderr, "Usage: %s -a [-d|-f] [-l]\n", getprogname());
@@ -293,7 +290,7 @@
* Open a BPF file and attach it to the interface named 'device'.
* Set immediate mode, and set a filter that accepts only RARP requests.
*/
-int
+static int
rarp_open(char *device)
{
int fd;
@@ -434,7 +431,7 @@
* Loop indefinitely listening for RARP requests on the
* interfaces in 'iflist'.
*/
-void
+static void
rarp_loop(void)
{
u_char *buf, *bp, *ep;
@@ -524,7 +521,7 @@
* This check is made by looking in the tftp directory for the
* configuration file.
*/
-int
+static int
rarp_bootable(u_int32_t addr)
{
struct dirent *dent;
@@ -560,7 +557,7 @@
* is on network 'net'; 'netmask' is a mask indicating the network portion
* of the address.
*/
-u_int32_t
+static u_int32_t
choose_ipaddr(u_int32_t **alist, u_int32_t net, u_int32_t netmask)
{
@@ -574,7 +571,7 @@
* Answer the RARP request in 'pkt', on the interface 'ii'. 'pkt' has
* already been checked for validity. The reply is overlaid on the request.
*/
-void
+static void
rarp_process(struct if_info *ii, u_char *pkt)
{
struct ether_header *ep;
@@ -631,7 +628,7 @@
* Lookup the ethernet address of the interface attached to the BPF
* file descriptor 'fd'; return it in 'eaddr'.
*/
-void
+static void
lookup_eaddr(char *ifname, u_char *eaddr)
{
struct ifaddrs *ifap, *ifa;
@@ -662,7 +659,7 @@
/*
* Lookup the IP address and network mask of the interface named 'ifname'.
*/
-void
+static void
lookup_ipaddr(char *ifname, u_int32_t *addrp, u_int32_t *netmaskp)
{
int fd;
@@ -713,7 +710,7 @@
* address of the guy being booted (he cannot answer the ARP).
*/
#ifndef __NetBSD__
-void
+static void
update_arptab(u_char *ep, u_int32_t ipaddr)
{
struct arpreq request;
@@ -773,7 +770,7 @@
* address pair (arp_spa, arp_sha) may eliminate the need for a subsequent
* ARP request.
*/
-void
+static void
rarp_reply(struct if_info *ii, struct ether_header *ep, u_int32_t ipaddr,
struct hostent *hp)
{
@@ -844,7 +841,7 @@
* Get the netmask of an IP address. This routine is used if
* SIOCGIFNETMASK doesn't work.
*/
-u_int32_t
+static u_int32_t
ipaddrtonetmask(u_int32_t addr)
{
@@ -861,7 +858,7 @@
#include <stdarg.h>
-void
+static void
rarperr(int fatal, const char *fmt,...)
{
va_list ap;
@@ -884,7 +881,7 @@
/* NOTREACHED */
}
-void
+static void
debug(const char *fmt,...)
{
va_list ap;
Home |
Main Index |
Thread Index |
Old Index