Sat Aug 25 07:06:48 2018 UTC ()
Pull up following revision(s) (requested by roy in ticket #976):

	sbin/route/route.c: revision 1.160

Resolve every route(4) message type before printing anything more about it
other than the type and length.

This solves the issue where RTM_ONEWADDR is received and it tries to
parse route information from it.


(martin)
diff -r1.155.4.3 -r1.155.4.4 src/sbin/route/route.c

cvs diff -r1.155.4.3 -r1.155.4.4 src/sbin/route/route.c (expand / switch to unified diff)

--- src/sbin/route/route.c 2018/04/09 13:34:11 1.155.4.3
+++ src/sbin/route/route.c 2018/08/25 07:06:48 1.155.4.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: route.c,v 1.155.4.3 2018/04/09 13:34:11 bouyer Exp $ */ 1/* $NetBSD: route.c,v 1.155.4.4 2018/08/25 07:06:48 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1983, 1989, 1991, 1993 4 * Copyright (c) 1983, 1989, 1991, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -29,27 +29,27 @@ @@ -29,27 +29,27 @@
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34__COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1991, 1993\ 34__COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1991, 1993\
35 The Regents of the University of California. All rights reserved."); 35 The Regents of the University of California. All rights reserved.");
36#endif /* not lint */ 36#endif /* not lint */
37 37
38#ifndef lint 38#ifndef lint
39#if 0 39#if 0
40static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95"; 40static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95";
41#else 41#else
42__RCSID("$NetBSD: route.c,v 1.155.4.3 2018/04/09 13:34:11 bouyer Exp $"); 42__RCSID("$NetBSD: route.c,v 1.155.4.4 2018/08/25 07:06:48 martin Exp $");
43#endif 43#endif
44#endif /* not lint */ 44#endif /* not lint */
45 45
46#include <sys/param.h> 46#include <sys/param.h>
47#include <sys/file.h> 47#include <sys/file.h>
48#include <sys/socket.h> 48#include <sys/socket.h>
49#include <sys/ioctl.h> 49#include <sys/ioctl.h>
50#include <sys/sysctl.h> 50#include <sys/sysctl.h>
51 51
52#include <net/if.h> 52#include <net/if.h>
53#include <net/route.h> 53#include <net/route.h>
54#include <net/if_dl.h> 54#include <net/if_dl.h>
55#include <net80211/ieee80211_netbsd.h> 55#include <net80211/ieee80211_netbsd.h>
@@ -1452,31 +1452,34 @@ print_rtmsg(struct rt_msghdr *rtm, int m @@ -1452,31 +1452,34 @@ print_rtmsg(struct rt_msghdr *rtm, int m
1452 switch (ifan->ifan_what) { 1452 switch (ifan->ifan_what) {
1453 case IFAN_ARRIVAL: 1453 case IFAN_ARRIVAL:
1454 printf("arrival"); 1454 printf("arrival");
1455 break; 1455 break;
1456 case IFAN_DEPARTURE: 1456 case IFAN_DEPARTURE:
1457 printf("departure"); 1457 printf("departure");
1458 break; 1458 break;
1459 default: 1459 default:
1460 printf("#%d", ifan->ifan_what); 1460 printf("#%d", ifan->ifan_what);
1461 break; 1461 break;
1462 } 1462 }
1463 printf("\n"); 1463 printf("\n");
1464 break; 1464 break;
1465 default: 1465 case RTM_ADD:
 1466 case RTM_DELETE:
 1467 case RTM_GET:
1466 (void)printf("pid %d, seq %d, errno %d, flags: ", 1468 (void)printf("pid %d, seq %d, errno %d, flags: ",
1467 rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno); 1469 rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno);
1468 bprintf(stdout, rtm->rtm_flags, routeflags); 1470 bprintf(stdout, rtm->rtm_flags, routeflags);
1469 pmsg_common(rtm); 1471 pmsg_common(rtm);
 1472 break;
1470 } 1473 }
1471} 1474}
1472 1475
1473#ifndef SMALL 1476#ifndef SMALL
1474static int 1477static int
1475print_getmsg(struct rt_msghdr *rtm, int msglen, struct sou *soup) 1478print_getmsg(struct rt_msghdr *rtm, int msglen, struct sou *soup)
1476{ 1479{
1477 struct sockaddr *dst = NULL, *gate = NULL, *mask = NULL, *ifa = NULL, *mpls = NULL; 1480 struct sockaddr *dst = NULL, *gate = NULL, *mask = NULL, *ifa = NULL, *mpls = NULL;
1478 struct sockaddr_dl *ifp = NULL; 1481 struct sockaddr_dl *ifp = NULL;
1479 struct sockaddr *sa; 1482 struct sockaddr *sa;
1480 char *cp; 1483 char *cp;
1481 int i; 1484 int i;
1482 1485