Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/route6d static + __dead + G/C



details:   https://anonhg.NetBSD.org/src/rev/1b73b1fc4caf
branches:  trunk
changeset: 769072:1b73b1fc4caf
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Aug 30 21:26:11 2011 +0000

description:
static + __dead + G/C

diffstat:

 usr.sbin/route6d/route6d.c |  359 ++++++++++++++++----------------------------
 1 files changed, 130 insertions(+), 229 deletions(-)

diffs (truncated from 760 to 300 lines):

diff -r c6c5e7801aec -r 1b73b1fc4caf usr.sbin/route6d/route6d.c
--- a/usr.sbin/route6d/route6d.c        Tue Aug 30 21:18:11 2011 +0000
+++ b/usr.sbin/route6d/route6d.c        Tue Aug 30 21:26:11 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route6d.c,v 1.63 2010/04/23 15:30:30 plunky Exp $      */
+/*     $NetBSD: route6d.c,v 1.64 2011/08/30 21:26:11 joerg Exp $       */
 /*     $KAME: route6d.c,v 1.94 2002/10/26 20:08:55 itojun Exp $        */
 
 /*
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef        lint
-__RCSID("$NetBSD: route6d.c,v 1.63 2010/04/23 15:30:30 plunky Exp $");
+__RCSID("$NetBSD: route6d.c,v 1.64 2011/08/30 21:26:11 joerg Exp $");
 #endif
 
 #include <stdbool.h>
@@ -129,16 +129,16 @@
        struct  iff *iff_next;
 };
 
-struct ifc *ifc;
-int    nifc;           /* number of valid ifc's */
-struct ifc **index2ifc;
-int    nindex2ifc;
-struct ifc *loopifcp = NULL;   /* pointing to loopback */
-struct pollfd set[2];
-int    rtsock;         /* the routing socket */
-int    ripsock;        /* socket to send/receive RIP datagram */
+static struct  ifc *ifc;
+static int     nifc;           /* number of valid ifc's */
+static struct  ifc **index2ifc;
+static int     nindex2ifc;
+static struct  ifc *loopifcp = NULL;   /* pointing to loopback */
+static struct  pollfd set[2];
+static int     rtsock;         /* the routing socket */
+static int     ripsock;        /* socket to send/receive RIP datagram */
 
-struct rip6 *ripbuf;   /* packet buffer for sending */
+static struct  rip6 *ripbuf;   /* packet buffer for sending */
 
 /*
  * Maintain the routes in a linked list.  When the number of the routes
@@ -163,41 +163,38 @@
        int     rrt_index;              /* ifindex from which this route got */
 };
 
-struct riprt *riprt = 0;
+static struct  riprt *riprt = 0;
 
-int    dflag = 0;      /* debug flag */
-int    qflag = 0;      /* quiet flag */
-int    nflag = 0;      /* don't update kernel routing table */
-int    aflag = 0;      /* age out even the statically defined routes */
-int    hflag = 0;      /* don't split horizon */
-int    lflag = 0;      /* exchange site local routes */
-int    sflag = 0;      /* announce static routes w/ split horizon */
-int    Sflag = 0;      /* announce static routes to every interface */
-unsigned long routetag = 0;    /* route tag attached on originating case */
+static int     dflag = 0;      /* debug flag */
+static int     qflag = 0;      /* quiet flag */
+static int     nflag = 0;      /* don't update kernel routing table */
+static int     aflag = 0;      /* age out even the statically defined routes */
+static int     hflag = 0;      /* don't split horizon */
+static int     lflag = 0;      /* exchange site local routes */
+static int     sflag = 0;      /* announce static routes w/ split horizon */
+static int     Sflag = 0;      /* announce static routes to every interface */
+static unsigned long routetag = 0;     /* route tag attached on originating case */
 
-char   *filter[MAXFILTER];
-int    filtertype[MAXFILTER];
-int    nfilter = 0;
+static char    *filter[MAXFILTER];
+static int     filtertype[MAXFILTER];
+static int     nfilter = 0;
 
-pid_t  pid;
-
-struct sockaddr_storage ripsin;
+static pid_t   pid;
 
-struct rtentry rtentry;
+static struct  sockaddr_storage ripsin;
 
-int    interval = 1;
-time_t nextalarm = 0;
-time_t sup_trig_update = 0;
+static int     interval = 1;
+static time_t  nextalarm = 0;
 
-FILE   *rtlog = NULL;
+static FILE    *rtlog = NULL;
 
-int logopened = 0;
+static int logopened = 0;
 
 static int     seq = 0;
 
-volatile sig_atomic_t seenalrm;
-volatile sig_atomic_t seenquit;
-volatile sig_atomic_t seenusr1;
+static volatile sig_atomic_t seenalrm;
+static volatile sig_atomic_t seenquit;
+static volatile sig_atomic_t seenusr1;
 
 #define        RRTF_AGGREGATE          0x08000000
 #define        RRTF_NOADVERTISE        0x10000000
@@ -205,77 +202,66 @@
 #define RRTF_SENDANYWAY                0x40000000
 #define        RRTF_CHANGED            0x80000000
 
-int    main(int, char **);
-void   sighandler(int);
-void   ripalarm(void);
-void   riprecv(void);
-void   ripsend(struct ifc *, struct sockaddr_in6 *, int);
-int    out_filter(struct riprt *, struct ifc *);
-void   init(void);
-void   sockopt(struct ifc *);
-void   ifconfig(void);
-void   ifconfig1(const char *, const struct sockaddr *, struct ifc *, int);
-void   rtrecv(void);
-int    rt_del(const struct sockaddr_in6 *, const struct sockaddr_in6 *,
+static void    sighandler(int);
+static void    ripalarm(void);
+static void    riprecv(void);
+static void    ripsend(struct ifc *, struct sockaddr_in6 *, int);
+static int     out_filter(struct riprt *, struct ifc *);
+static void    init(void);
+static void    ifconfig(void);
+static void    ifconfig1(const char *, const struct sockaddr *, struct ifc *, int);
+static void    rtrecv(void);
+static int     rt_del(const struct sockaddr_in6 *, const struct sockaddr_in6 *,
            const struct sockaddr_in6 *);
-int    rt_deladdr(struct ifc *, const struct sockaddr_in6 *,
+static int     rt_deladdr(struct ifc *, const struct sockaddr_in6 *,
            const struct sockaddr_in6 *);
-void   filterconfig(void);
-int    getifmtu(int);
-const char *
+static void    filterconfig(void);
+static int     getifmtu(int);
+static const char *
        rttypes(struct rt_msghdr *);
-const char *
+static const char *
        rtflags(struct rt_msghdr *);
-const char *
+static const char *
        ifflags(int);
-int    ifrt(struct ifc *, int);
-void   ifrt_p2p(struct ifc *, int);
-void   applymask(struct in6_addr *, struct in6_addr *);
-void   applyplen(struct in6_addr *, int);
-void   ifrtdump(int);
-void   ifdump(int);
-void   ifdump0(FILE *, const struct ifc *);
-void   rtdump(int);
-void   rt_entry(struct rt_msghdr *, int);
-void   rtdexit(void);
-void   riprequest(struct ifc *, struct netinfo6 *, int,
+static int     ifrt(struct ifc *, int);
+static void    ifrt_p2p(struct ifc *, int);
+static void    applyplen(struct in6_addr *, int);
+static void    ifrtdump(int);
+static void    ifdump(int);
+static void    ifdump0(FILE *, const struct ifc *);
+static void    rtdump(int);
+static void    rt_entry(struct rt_msghdr *, int);
+static void    rtdexit(void) __dead;
+static void    riprequest(struct ifc *, struct netinfo6 *, int,
            struct sockaddr_in6 *);
-void   ripflush(struct ifc *, struct sockaddr_in6 *);
-void   sendrequest(struct ifc *);
-int    sin6mask2len(const struct sockaddr_in6 *);
-int    mask2len(const struct in6_addr *, int);
-int    sendpacket(struct sockaddr_in6 *, int);
-int    addroute(struct riprt *, const struct in6_addr *, struct ifc *);
-int    delroute(struct netinfo6 *, struct in6_addr *);
-struct in6_addr *
-       getroute(struct netinfo6 *, struct in6_addr *);
-void   krtread(int);
-int    tobeadv(struct riprt *, struct ifc *);
-char * allocopy(char *);
-char * hms(void);
-const char *
+static void    ripflush(struct ifc *, struct sockaddr_in6 *);
+static void    sendrequest(struct ifc *);
+static int     sin6mask2len(const struct sockaddr_in6 *);
+static int     mask2len(const struct in6_addr *, int);
+static int     sendpacket(struct sockaddr_in6 *, int);
+static int     addroute(struct riprt *, const struct in6_addr *, struct ifc *);
+static int     delroute(struct netinfo6 *, struct in6_addr *);
+static void    krtread(int);
+static int     tobeadv(struct riprt *, struct ifc *);
+static char *  allocopy(char *);
+static char *  hms(void);
+static const char *
        inet6_n2p(const struct in6_addr *);
-struct ifac *
+static struct ifac *
        ifa_match(const struct ifc *, const struct in6_addr *, int);
-struct in6_addr *
+static struct in6_addr *
        plen2mask(int);
-struct riprt *
+static struct riprt *
        rtsearch(struct netinfo6 *, struct riprt **);
-int    ripinterval(int);
-time_t ripsuptrig(void);
-void   fatal(const char *, ...)
-       __attribute__((__format__(__printf__, 1, 2)));
-void   trace(int, const char *, ...)
-       __attribute__((__format__(__printf__, 2, 3)));
-void   tracet(int, const char *, ...)
-       __attribute__((__format__(__printf__, 2, 3)));
-unsigned int
-       if_maxindex(void);
-struct ifc *
+static int     ripinterval(int);
+static void    fatal(const char *, ...) __printflike(1, 2) __dead;
+static void    trace(int, const char *, ...) __printflike(2, 3);
+static void    tracet(int, const char *, ...) __printflike(2, 3);
+static struct ifc *
        ifc_find(char *);
-struct iff *
+static struct iff *
        iff_find(struct ifc *, int);
-void   setindex2ifc(int, struct ifc *);
+static void    setindex2ifc(int, struct ifc *);
 
 #define        MALLOC(type)    ((type *)malloc(sizeof(type)))
 
@@ -475,7 +461,7 @@
        }
 }
 
-void
+static void
 sighandler(int signo)
 {
 
@@ -499,7 +485,7 @@
  * gracefully exits after resetting sockopts.
  */
 /* ARGSUSED */
-void
+static void
 rtdexit(void)
 {
        struct  riprt *rrt;
@@ -526,7 +512,7 @@
  * routes more precisely.
  */
 /* ARGSUSED */
-void
+static void
 ripalarm(void)
 {
        struct  ifc *ifcp;
@@ -566,7 +552,7 @@
        alarm(ripinterval(SUPPLY_INTERVAL6));
 }
 
-void
+static void
 init(void)
 {
        int     i, error;
@@ -672,7 +658,7 @@
 static int nrt;
 static struct netinfo6 *nip;
 
-void
+static void
 ripflush(struct ifc *ifcp, struct sockaddr_in6 *sin6)
 {
        int i;
@@ -721,7 +707,7 @@
 /*
  * Generate RIP6_RESPONSE packets and send them.
  */
-void
+static void
 ripsend(struct ifc *ifcp, struct sockaddr_in6 *sin6, int flag)
 {
        struct  riprt *rrt;
@@ -847,7 +833,7 @@
 /*
  * outbound filter logic, per-route/interface.
  */
-int
+static int
 out_filter(struct riprt *rrt, struct ifc *ifcp)
 {
        struct iff *iffp;
@@ -918,7 +904,7 @@
  * Determine if the route is to be advertised on the specified interface.
  * It checks options specified in the arguments and the split horizon rule.



Home | Main Index | Thread Index | Old Index