Commit f49558dc authored by Kevin Bracey's avatar Kevin Bracey
Browse files

Added MRInfo.

MTrace would occasionally close someone else's socket.
parent 13a8ce37
......@@ -56,6 +56,7 @@ FILES=\
${SDIR}.ifconfig.IfConfig\
${SDIR}.inetstat.InetStat\
${SDIR}.map-mbone.Map-MBone\
${SDIR}.mrinfo.MRInfo\
${SDIR}.mtrace.MTrace\
${SDIR}.ping.Ping\
${SDIR}.pong.Pong\
......@@ -81,6 +82,7 @@ NETUTILS = \
${SDIR}.ifconfig.IfConfig \
${SDIR}.inetstat.InetStat \
${SDIR}.map-mbone.Map-MBone \
${SDIR}.mrinfo.MRInfo \
${SDIR}.mtrace.MTrace \
${SDIR}.ping.Ping \
${SDIR}.pong.Pong \
......@@ -117,6 +119,7 @@ install: ${FILES}
${CP} ${SDIR}.ifconfig.IfConfig ${INSTDIR}.bin.IfConfig ${CPFLAGS}
${CP} ${SDIR}.inetstat.InetStat ${INSTDIR}.bin.InetStat ${CPFLAGS}
${CP} ${SDIR}.map-mbone.Map-MBone ${INSTDIR}.bin.Map-MBone ${CPFLAGS}
${CP} ${SDIR}.mrinfo.MRInfo ${INSTDIR}.bin.MRInfo ${CPFLAGS}
${CP} ${SDIR}.mtrace.MTrace ${INSTDIR}.bin.MTrace ${CPFLAGS}
${CP} ${SDIR}.ping.Ping ${INSTDIR}.bin.Ping ${CPFLAGS}
${CP} ${SDIR}.pong.Pong ${INSTDIR}.bin.Pong ${CPFLAGS}
......@@ -155,6 +158,7 @@ resources-NetUtils: ${NETUTILS}
${CP} ${SDIR}.ifconfig.IfConfig ${RESD}.bin.IfConfig ${CPFLAGS}
${CP} ${SDIR}.inetstat.InetStat ${RESD}.bin.InetStat ${CPFLAGS}
${CP} ${SDIR}.map-mbone.Map-MBone ${RESD}.bin.Map-MBone ${CPFLAGS}
${CP} ${SDIR}.mrinfo.MRInfo ${RESD}.bin.MRInfo ${CPFLAGS}
${CP} ${SDIR}.mtrace.MTrace ${RESD}.bin.MTrace ${CPFLAGS}
${CP} ${SDIR}.ping.Ping ${RESD}.bin.Ping ${CPFLAGS}
${CP} ${SDIR}.pong.Pong ${RESD}.bin.Pong ${CPFLAGS}
......@@ -205,6 +209,15 @@ ${SDIR}.map-mbone.Map-MBone: ${SDIR}.map-mbone.c.Map-MBone \
@up
@up
${SDIR}.mrinfo.MRInfo: ${SDIR}.mrinfo.c.MRInfo \
${SDIR}.mrinfo.c.igmp \
${SDIR}.mrinfo.c.inet \
${SDIR}.mrinfo.c.kern
dir ${SDIR}.mrinfo
@amu_machine
@up
@up
${SDIR}.mtrace.MTrace: ${SDIR}.mtrace.c.MTrace
dir ${SDIR}.mtrace
@amu_machine
......
# Copyright 1999 Pace Micro Technology plc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
TARGET= MRInfo
INCLUDES= C:,TCPIPLibs:
CC= cc
RM= remove
WFLAGS= fr~c~v
WIPE= -wipe
CFLAGS= -Wp -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
OBJS= o.${TARGET} o.igmp o.inet o.kern
LIBS= C:o.Stubs TCPIPLibs:o.Unixlib TCPIPLibs:o.Inetlib \
TCPIPLibs:o.Socklib5
.SUFFIXES: .c .o
.c.o:; $(CC) $(CFLAGS) -o $@ $<
${TARGET}: $(OBJS) $(LIBS)
Link -o $@ $(OBJS) $(LIBS)
Squeeze $@
clean:; ${RM} ${TARGET}
${WIPE} o.* ${WFLAGS}
# Dynamic dependencies:
o.igmp: c.igmp
o.igmp: h.defs
o.igmp: TCPIPLibs:h.unistd
o.igmp: TCPIPLibs:sys.h.cdefs
o.igmp: TCPIPLibs:sys.h.types
o.igmp: TCPIPLibs:sys.h.cdefs
o.igmp: TCPIPLibs:machine.h.endian
o.igmp: TCPIPLibs:machine.h.ansi
o.igmp: TCPIPLibs:machine.h.types
o.igmp: TCPIPLibs:sys.h.unistd
o.igmp: TCPIPLibs:sys.h._posix
o.igmp: TCPIPLibs:sys.h.param
o.igmp: TCPIPLibs:sys.h.types
o.igmp: TCPIPLibs:sys.h.syslimits
o.igmp: TCPIPLibs:sys.h.signal
o.igmp: TCPIPLibs:machine.h.signal
o.igmp: TCPIPLibs:sys.h.cdefs
o.igmp: TCPIPLibs:machine.h.param
o.igmp: TCPIPLibs:machine.h.limits
o.igmp: TCPIPLibs:sys.h.types
o.igmp: TCPIPLibs:sys.h.socket
o.igmp: TCPIPLibs:sys.h.cdefs
o.igmp: TCPIPLibs:sys.h.ioctl
o.igmp: TCPIPLibs:sys.h.ttycom
o.igmp: TCPIPLibs:sys.h.ioccom
o.igmp: TCPIPLibs:sys.h.ioccom
o.igmp: TCPIPLibs:sys.h.filio
o.igmp: TCPIPLibs:sys.h.ioccom
o.igmp: TCPIPLibs:sys.h.sockio
o.igmp: TCPIPLibs:sys.h.ioccom
o.igmp: TCPIPLibs:sys.h.cdefs
o.igmp: TCPIPLibs:sys.h.time
o.igmp: TCPIPLibs:sys.h.cdefs
o.igmp: TCPIPLibs:sys.h.uio
o.igmp: TCPIPLibs:sys.h.cdefs
o.igmp: TCPIPLibs:net.h.if
o.igmp: TCPIPLibs:sys.h.time
o.igmp: TCPIPLibs:net.h.route
o.igmp: TCPIPLibs:net.h.radix
o.igmp: TCPIPLibs:netinet.h.in
o.igmp: TCPIPLibs:netinet.h.in_systm
o.igmp: TCPIPLibs:netinet.h.ip
o.igmp: TCPIPLibs:netinet.h.ip_icmp
o.igmp: TCPIPLibs:netinet.h.igmp
o.igmp: TCPIPLibs:netinet.h.ip_mroute
o.igmp: TCPIPLibs:h.socklib
o.igmp: TCPIPLibs:sys.h.types
o.igmp: TCPIPLibs:sys.h.socket
o.igmp: TCPIPLibs:sys.h.stat
o.igmp: TCPIPLibs:sys.h.time
o.igmp: TCPIPLibs:sys.h.cdefs
o.igmp: TCPIPLibs:sys.h.time
o.igmp: TCPIPLibs:sys.h.uio
o.igmp: C:h.kernel
o.igmp: TCPIPLibs:h.unixlib
o.igmp: TCPIPLibs:sys.h.syslog
o.igmp: TCPIPLibs:machine.h.ansi
o.igmp: TCPIPLibs:sys.h.cdefs
o.igmp: TCPIPLibs:sys.h.errno
o.igmp: C:h.kernel
o.igmp: h.dvmrp
o.igmp: h.igmpv2
o.igmp: h.vif
o.igmp: h.route
o.igmp: h.prune
o.igmp: h.pathnames
o.inet: c.inet
o.inet: h.defs
o.inet: TCPIPLibs:h.unistd
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:sys.h.types
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:machine.h.endian
o.inet: TCPIPLibs:machine.h.ansi
o.inet: TCPIPLibs:machine.h.types
o.inet: TCPIPLibs:sys.h.unistd
o.inet: TCPIPLibs:sys.h._posix
o.inet: TCPIPLibs:sys.h.param
o.inet: TCPIPLibs:sys.h.types
o.inet: TCPIPLibs:sys.h.syslimits
o.inet: TCPIPLibs:sys.h.signal
o.inet: TCPIPLibs:machine.h.signal
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:machine.h.param
o.inet: TCPIPLibs:machine.h.limits
o.inet: TCPIPLibs:sys.h.types
o.inet: TCPIPLibs:sys.h.socket
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:sys.h.ioctl
o.inet: TCPIPLibs:sys.h.ttycom
o.inet: TCPIPLibs:sys.h.ioccom
o.inet: TCPIPLibs:sys.h.ioccom
o.inet: TCPIPLibs:sys.h.filio
o.inet: TCPIPLibs:sys.h.ioccom
o.inet: TCPIPLibs:sys.h.sockio
o.inet: TCPIPLibs:sys.h.ioccom
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:sys.h.time
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:sys.h.uio
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:net.h.if
o.inet: TCPIPLibs:sys.h.time
o.inet: TCPIPLibs:net.h.route
o.inet: TCPIPLibs:net.h.radix
o.inet: TCPIPLibs:netinet.h.in
o.inet: TCPIPLibs:netinet.h.in_systm
o.inet: TCPIPLibs:netinet.h.ip
o.inet: TCPIPLibs:netinet.h.ip_icmp
o.inet: TCPIPLibs:netinet.h.igmp
o.inet: TCPIPLibs:netinet.h.ip_mroute
o.inet: TCPIPLibs:h.socklib
o.inet: TCPIPLibs:sys.h.types
o.inet: TCPIPLibs:sys.h.socket
o.inet: TCPIPLibs:sys.h.stat
o.inet: TCPIPLibs:sys.h.time
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:sys.h.time
o.inet: TCPIPLibs:sys.h.uio
o.inet: C:h.kernel
o.inet: TCPIPLibs:h.unixlib
o.inet: TCPIPLibs:sys.h.syslog
o.inet: TCPIPLibs:machine.h.ansi
o.inet: TCPIPLibs:sys.h.cdefs
o.inet: TCPIPLibs:sys.h.errno
o.inet: C:h.kernel
o.inet: h.dvmrp
o.inet: h.igmpv2
o.inet: h.vif
o.inet: h.route
o.inet: h.prune
o.inet: h.pathnames
o.kern: c.kern
o.kern: h.defs
o.kern: TCPIPLibs:h.unistd
o.kern: TCPIPLibs:sys.h.cdefs
o.kern: TCPIPLibs:sys.h.types
o.kern: TCPIPLibs:sys.h.cdefs
o.kern: TCPIPLibs:machine.h.endian
o.kern: TCPIPLibs:machine.h.ansi
o.kern: TCPIPLibs:machine.h.types
o.kern: TCPIPLibs:sys.h.unistd
o.kern: TCPIPLibs:sys.h._posix
o.kern: TCPIPLibs:sys.h.param
o.kern: TCPIPLibs:sys.h.types
o.kern: TCPIPLibs:sys.h.syslimits
o.kern: TCPIPLibs:sys.h.signal
o.kern: TCPIPLibs:machine.h.signal
o.kern: TCPIPLibs:sys.h.cdefs
o.kern: TCPIPLibs:machine.h.param
o.kern: TCPIPLibs:machine.h.limits
o.kern: TCPIPLibs:sys.h.types
o.kern: TCPIPLibs:sys.h.socket
o.kern: TCPIPLibs:sys.h.cdefs
o.kern: TCPIPLibs:sys.h.ioctl
o.kern: TCPIPLibs:sys.h.ttycom
o.kern: TCPIPLibs:sys.h.ioccom
o.kern: TCPIPLibs:sys.h.ioccom
o.kern: TCPIPLibs:sys.h.filio
o.kern: TCPIPLibs:sys.h.ioccom
o.kern: TCPIPLibs:sys.h.sockio
o.kern: TCPIPLibs:sys.h.ioccom
o.kern: TCPIPLibs:sys.h.cdefs
o.kern: TCPIPLibs:sys.h.time
o.kern: TCPIPLibs:sys.h.cdefs
o.kern: TCPIPLibs:sys.h.uio
o.kern: TCPIPLibs:sys.h.cdefs
o.kern: TCPIPLibs:net.h.if
o.kern: TCPIPLibs:sys.h.time
o.kern: TCPIPLibs:net.h.route
o.kern: TCPIPLibs:net.h.radix
o.kern: TCPIPLibs:netinet.h.in
o.kern: TCPIPLibs:netinet.h.in_systm
o.kern: TCPIPLibs:netinet.h.ip
o.kern: TCPIPLibs:netinet.h.ip_icmp
o.kern: TCPIPLibs:netinet.h.igmp
o.kern: TCPIPLibs:netinet.h.ip_mroute
o.kern: TCPIPLibs:h.socklib
o.kern: TCPIPLibs:sys.h.types
o.kern: TCPIPLibs:sys.h.socket
o.kern: TCPIPLibs:sys.h.stat
o.kern: TCPIPLibs:sys.h.time
o.kern: TCPIPLibs:sys.h.cdefs
o.kern: TCPIPLibs:sys.h.time
o.kern: TCPIPLibs:sys.h.uio
o.kern: C:h.kernel
o.kern: TCPIPLibs:h.unixlib
o.kern: TCPIPLibs:sys.h.syslog
o.kern: TCPIPLibs:machine.h.ansi
o.kern: TCPIPLibs:sys.h.cdefs
o.kern: TCPIPLibs:sys.h.errno
o.kern: C:h.kernel
o.kern: h.dvmrp
o.kern: h.igmpv2
o.kern: h.vif
o.kern: h.route
o.kern: h.prune
o.kern: h.pathnames
o.MRInfo: c.MRInfo
o.MRInfo: TCPIPLibs:h.err
o.MRInfo: TCPIPLibs:machine.h.ansi
o.MRInfo: TCPIPLibs:sys.h.cdefs
o.MRInfo: TCPIPLibs:h.netdb
o.MRInfo: TCPIPLibs:sys.h.cdefs
o.MRInfo: TCPIPLibs:sys.h.time
o.MRInfo: TCPIPLibs:sys.h.cdefs
o.MRInfo: h.defs
o.MRInfo: TCPIPLibs:h.unistd
o.MRInfo: TCPIPLibs:sys.h.cdefs
o.MRInfo: TCPIPLibs:sys.h.types
o.MRInfo: TCPIPLibs:sys.h.cdefs
o.MRInfo: TCPIPLibs:machine.h.endian
o.MRInfo: TCPIPLibs:machine.h.ansi
o.MRInfo: TCPIPLibs:machine.h.types
o.MRInfo: TCPIPLibs:sys.h.unistd
o.MRInfo: TCPIPLibs:sys.h._posix
o.MRInfo: TCPIPLibs:sys.h.param
o.MRInfo: TCPIPLibs:sys.h.types
o.MRInfo: TCPIPLibs:sys.h.syslimits
o.MRInfo: TCPIPLibs:sys.h.signal
o.MRInfo: TCPIPLibs:machine.h.signal
o.MRInfo: TCPIPLibs:sys.h.cdefs
o.MRInfo: TCPIPLibs:machine.h.param
o.MRInfo: TCPIPLibs:machine.h.limits
o.MRInfo: TCPIPLibs:sys.h.types
o.MRInfo: TCPIPLibs:sys.h.socket
o.MRInfo: TCPIPLibs:sys.h.cdefs
o.MRInfo: TCPIPLibs:sys.h.ioctl
o.MRInfo: TCPIPLibs:sys.h.ttycom
o.MRInfo: TCPIPLibs:sys.h.ioccom
o.MRInfo: TCPIPLibs:sys.h.ioccom
o.MRInfo: TCPIPLibs:sys.h.filio
o.MRInfo: TCPIPLibs:sys.h.ioccom
o.MRInfo: TCPIPLibs:sys.h.sockio
o.MRInfo: TCPIPLibs:sys.h.ioccom
o.MRInfo: TCPIPLibs:sys.h.cdefs
o.MRInfo: TCPIPLibs:sys.h.time
o.MRInfo: TCPIPLibs:sys.h.uio
o.MRInfo: TCPIPLibs:sys.h.cdefs
o.MRInfo: TCPIPLibs:net.h.if
o.MRInfo: TCPIPLibs:sys.h.time
o.MRInfo: TCPIPLibs:net.h.route
o.MRInfo: TCPIPLibs:net.h.radix
o.MRInfo: TCPIPLibs:netinet.h.in
o.MRInfo: TCPIPLibs:netinet.h.in_systm
o.MRInfo: TCPIPLibs:netinet.h.ip
o.MRInfo: TCPIPLibs:netinet.h.ip_icmp
o.MRInfo: TCPIPLibs:netinet.h.igmp
o.MRInfo: TCPIPLibs:netinet.h.ip_mroute
o.MRInfo: TCPIPLibs:h.socklib
o.MRInfo: TCPIPLibs:sys.h.types
o.MRInfo: TCPIPLibs:sys.h.socket
o.MRInfo: TCPIPLibs:sys.h.stat
o.MRInfo: TCPIPLibs:sys.h.time
o.MRInfo: TCPIPLibs:sys.h.cdefs
o.MRInfo: TCPIPLibs:sys.h.time
o.MRInfo: TCPIPLibs:sys.h.uio
o.MRInfo: C:h.kernel
o.MRInfo: TCPIPLibs:h.unixlib
o.MRInfo: TCPIPLibs:sys.h.syslog
o.MRInfo: TCPIPLibs:machine.h.ansi
o.MRInfo: TCPIPLibs:sys.h.cdefs
o.MRInfo: TCPIPLibs:sys.h.errno
o.MRInfo: C:h.kernel
o.MRInfo: h.dvmrp
o.MRInfo: h.igmpv2
o.MRInfo: h.vif
o.MRInfo: h.route
o.MRInfo: h.prune
o.MRInfo: h.pathnames
o.MRInfo: TCPIPLibs:arpa.h.inet
o.MRInfo: TCPIPLibs:sys.h.cdefs
/*
* This tool requests configuration info from a multicast router
* and prints the reply (if any). Invoke it as:
*
* mrinfo router-name-or-address
*
* Written Wed Mar 24 1993 by Van Jacobson (adapted from the
* multicast mapper written by Pavel Curtis).
*
* The lawyers insist we include the following UC copyright notice.
* The mapper from which this is derived contained a Xerox copyright
* notice which follows the UC one. Try not to get depressed noting
* that the legal gibberish is larger than the program.
*
* Copyright (c) 1993 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the Computer Systems
* Engineering Group at Lawrence Berkeley Laboratory.
* 4. Neither the name of the University nor of the Laboratory may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ---------------------------------
* Copyright (c) Xerox Corporation 1992. All rights reserved.
*
* License is granted to copy, to use, and to make and to use derivative works
* for research and evaluation purposes, provided that Xerox is acknowledged
* in all documentation pertaining to any such copy or derivative work. Xerox
* grants no other licenses expressed or implied. The Xerox trade name should
* not be used in any advertising without its written permission.
*
* XEROX CORPORATION MAKES NO REPRESENTATIONS CONCERNING EITHER THE
* MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE FOR
* ANY PARTICULAR PURPOSE. The software is provided "as is" without express
* or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this software.
*/
#ifndef lint
static const char rcsid[] =
"$Id$";
/* original rcsid:
"@(#) Header: mrinfo.c,v 1.6 93/04/08 15:14:16 van Exp (LBL)";
*/
#endif
#include <err.h>
#include <netdb.h>
#include <sys/time.h>
#include "defs.h"
#include <arpa/inet.h>
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#ifdef __riscos
char *__progname = "Map-MBone";
static void closesockets(void)
{
if (igmp_socket >= 0) close(igmp_socket);
}
#endif
#define DEFAULT_TIMEOUT 4 /* How long to wait before retrying requests */
#define DEFAULT_RETRIES 3 /* How many times to ask each router */
u_int32 our_addr, target_addr = 0; /* in NET order */
int debug = 0;
int nflag = 0;
int retries = DEFAULT_RETRIES;
int timeout = DEFAULT_TIMEOUT;
int target_level = 0;
vifi_t numvifs; /* to keep loader happy */
/* (see COPY_TABLES macro called in kern.c) */
char * inet_name __P((u_int32 addr));
void ask __P((u_int32 dst));
void ask2 __P((u_int32 dst));
int get_number __P((int *var, int deflt, char ***pargv,
int *pargc));
u_int32 host_addr __P((char *name));
static void usage __P((void));
/* to shut up -Wstrict-prototypes */
int main __P((int argc, char *argv[]));
char *
inet_name(addr)
u_int32 addr;
{
struct hostent *e;
struct in_addr in;
if (addr == 0)
return "local";
if (nflag ||
(e = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET)) == NULL) {
in.s_addr = addr;
return (inet_ntoa(in));
}
return (e->h_name);
}
/*
* Log errors and other messages to stderr, according to the severity of the
* message and the current debug level. For errors of severity LOG_ERR or
* worse, terminate the program.
*/
#ifdef __STDC__
void
log(int severity, int syserr, char *format, ...)
{
va_list ap;
char fmt[100];
va_start(ap, format);
#else
void
log(severity, syserr, format, va_alist)
int severity, syserr;
char *format;
va_dcl
{
va_list ap;
char fmt[100];
va_start(ap);
#endif
switch (debug) {
case 0:
if (severity > LOG_WARNING)
return;
case 1:
if (severity > LOG_NOTICE)
return;
case 2:
if (severity > LOG_INFO)
return;
default:
fmt[0] = '\0';
if (severity == LOG_WARNING)
strcpy(fmt, "warning - ");
strncat(fmt, format, sizeof(fmt)-strlen(fmt));
fmt[sizeof(fmt)-1]='\0';
vfprintf(stderr, fmt, ap);
if (syserr == 0)
fprintf(stderr, "\n");
#ifdef __riscos
else if (syserr == errno)
fprintf(stderr, ": %s\n", _inet_err());
#else
else if (syserr < sys_nerr)
fprintf(stderr, ": %s\n", sys_errlist[syserr]);
#endif
else
fprintf(stderr, ": errno %d\n", syserr);
}
if (severity <= LOG_ERR)
exit(1);
}
/*
* Send a neighbors-list request.
*/
void
ask(dst)
u_int32 dst;
{
send_igmp(our_addr, dst, IGMP_DVMRP, DVMRP_ASK_NEIGHBORS,
htonl(MROUTED_LEVEL), 0);
}
void
ask2(dst)
u_int32 dst;
{
send_igmp(our_addr, dst, IGMP_DVMRP, DVMRP_ASK_NEIGHBORS2,
htonl(MROUTED_LEVEL), 0);
}
/*
* Process an incoming neighbor-list message.
*/
void
accept_neighbors(src, dst, p, datalen, level)
u_int32 src, dst, level;
u_char *p;
int datalen;
{
u_char *ep = p + datalen;
#define GET_ADDR(a) (a = ((u_int32)*p++ << 24), a += ((u_int32)*p++ << 16),\
a += ((u_int32)*p++ << 8), a += *p++)
printf("%s (%s):\n", inet_fmt(src, s1), inet_name(src));
while (p < ep) {
register u_int32 laddr;
register u_char metric;
register u_char thresh;
register int ncount;
GET_ADDR(laddr);
laddr = htonl(laddr);
metric = *p++;
thresh = *p++;
ncount = *p++;
while (--ncount >= 0) {
register u_int32 neighbor;
GET_ADDR(neighbor);
neighbor = htonl(neighbor);
printf(" %s -> ", inet_fmt(laddr, s1));
printf("%s (%s) [%d/%d]\n", inet_fmt(neighbor, s1),
inet_name(neighbor), metric, thresh);
}
}
}
void
accept_neighbors2(src, dst, p, datalen, level)
u_int32 src, dst, level;
u_char *p;
int datalen;
{
u_char *ep = p + datalen;
u_int broken_cisco = ((level & 0xffff) == 0x020a); /* 10.2 */
/* well, only possibly_broken_cisco, but that's too long to type. */
u_int majvers = level & 0xff;
u_int minvers = (level >> 8) & 0xff;
printf("%s (%s) [", inet_fmt(src, s1), inet_name(src));
if (majvers == 3 && minvers == 0xff)
printf("DVMRPv3 compliant");
else
printf("version %d.%d", majvers, minvers);
printf ("]:\n");
while (p < ep) {
register u_char metric;