summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rtadvd/advcap.c
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2011-06-06 03:06:43 +0000
committerhrs <hrs@FreeBSD.org>2011-06-06 03:06:43 +0000
commit10df0af5a54c03a258caf94e9931b16eec080d79 (patch)
tree7fcbcd5609e82351ec883059d7bfb466d7cb8ef6 /usr.sbin/rtadvd/advcap.c
parentacbda2ccc11fcdfe5fa5175c97ac29b4bb729bb5 (diff)
downloadFreeBSD-src-10df0af5a54c03a258caf94e9931b16eec080d79.zip
FreeBSD-src-10df0af5a54c03a258caf94e9931b16eec080d79.tar.gz
- Implement RDNSS and DNSSL options (RFC 6106, IPv6 Router Advertisement
Options for DNS Configuration) into rtadvd(8) and rtsold(8). DNS information received by rtsold(8) will go to resolv.conf(5) by resolvconf(8) script. This is based on work by J.R. Oldroyd (kern/156259) but revised extensively[1]. - rtadvd(8) now supports "noifprefix" to disable gathering on-link prefixes from interfaces when no "addr" is specified[2]. An entry in rtadvd.conf with "noifprefix" + no "addr" generates an RA message with no prefix information option. - rtadvd(8) now supports RTM_IFANNOUNCE message to fix crashes when an interface is added or removed. - Correct bogus ND_OPT_ROUTE_INFO value to one in RFC 4191. Reviewed by: bz[1] PR: kern/156259 [1] PR: bin/152458 [2]
Diffstat (limited to 'usr.sbin/rtadvd/advcap.c')
-rw-r--r--usr.sbin/rtadvd/advcap.c50
1 files changed, 18 insertions, 32 deletions
diff --git a/usr.sbin/rtadvd/advcap.c b/usr.sbin/rtadvd/advcap.c
index 792ea27..b0f5ee0 100644
--- a/usr.sbin/rtadvd/advcap.c
+++ b/usr.sbin/rtadvd/advcap.c
@@ -64,8 +64,6 @@
#define V_TERM "HOST"
#endif
-char *RM;
-
/*
* termcap - routines for dealing with the terminal capability data base
*
@@ -83,12 +81,11 @@ char *RM;
static char *tbuf;
static int hopcount; /* detect infinite loops in termcap, init 0 */
-static char *remotefile;
-
-extern char *conffile;
+static const char *remotefile;
+extern const char *conffile;
int tgetent(char *, char *);
-int getent(char *, char *, char *);
+int getent(char *, char *, const char *);
int tnchktc(void);
int tnamatch(char *);
static char *tskip(char *);
@@ -103,22 +100,18 @@ static char *tdecode(char *, char **);
* we just notice escaped newlines.
*/
int
-tgetent(bp, name)
- char *bp, *name;
+tgetent(char *bp, char *name)
{
- char *cp;
-
- remotefile = cp = conffile ? conffile : _PATH_RTADVDCONF;
- return (getent(bp, name, cp));
+ return (getent(bp, name, conffile));
}
int
-getent(bp, name, cp)
- char *bp, *name, *cp;
+getent(char *bp, char *name, const char *cfile)
{
int c;
int i = 0, cnt = 0;
char ibuf[BUFSIZ];
+ char *cp;
int tf;
tbuf = bp;
@@ -130,9 +123,9 @@ getent(bp, name, cp)
* use so we don't have to read the file. In this case it
* has to already have the newlines crunched out.
*/
- if (cp && *cp) {
- tf = open(RM = cp, O_RDONLY);
- }
+ if (cfile && *cfile)
+ tf = open(cfile, O_RDONLY);
+
if (tf < 0) {
syslog(LOG_INFO,
"<%s> open: %s", __func__, strerror(errno));
@@ -184,7 +177,7 @@ getent(bp, name, cp)
* Note that this works because of the left to right scan.
*/
int
-tnchktc()
+tnchktc(void)
{
char *p, *q;
char tcname[16]; /* name of similar terminal */
@@ -233,8 +226,7 @@ tnchktc()
* name (before the first field) stops us.
*/
int
-tnamatch(np)
- char *np;
+tnamatch(char *np)
{
char *Np, *Bp;
@@ -260,8 +252,7 @@ tnamatch(np)
* into the termcap file in octal.
*/
static char *
-tskip(bp)
- char *bp;
+tskip(char *bp)
{
int dquote;
@@ -305,8 +296,7 @@ breakbreak:
* Note that we handle octal numbers beginning with 0.
*/
int64_t
-tgetnum(id)
- char *id;
+tgetnum(char *id)
{
int64_t i;
int base;
@@ -341,8 +331,7 @@ tgetnum(id)
* not given.
*/
int
-tgetflag(id)
- char *id;
+tgetflag(char *id)
{
char *bp = tbuf;
@@ -369,8 +358,7 @@ tgetflag(id)
* No checking on area overflow.
*/
char *
-tgetstr(id, area)
- char *id, **area;
+tgetstr(char *id, char **area)
{
char *bp = tbuf;
@@ -395,13 +383,11 @@ tgetstr(id, area)
* string capability escapes.
*/
static char *
-tdecode(str, area)
- char *str;
- char **area;
+tdecode(char *str, char **area)
{
char *cp;
int c;
- char *dp;
+ const char *dp;
int i;
char term;
OpenPOWER on IntegriCloud