Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/pppd/pppd don't exit even if socket(AF_INET6) fails.
details: https://anonhg.NetBSD.org/src/rev/344ed6cca6e4
branches: trunk
changeset: 485133:344ed6cca6e4
user: itojun <itojun%NetBSD.org@localhost>
date: Thu Apr 20 03:28:15 2000 +0000
description:
don't exit even if socket(AF_INET6) fails.
check if sock6_fd is available at runtime.
diffstat:
usr.sbin/pppd/pppd/sys-bsd.c | 30 ++++++++++++++++++++++++++----
1 files changed, 26 insertions(+), 4 deletions(-)
diffs (79 lines):
diff -r b8293ce08bb2 -r 344ed6cca6e4 usr.sbin/pppd/pppd/sys-bsd.c
--- a/usr.sbin/pppd/pppd/sys-bsd.c Thu Apr 20 02:12:04 2000 +0000
+++ b/usr.sbin/pppd/pppd/sys-bsd.c Thu Apr 20 03:28:15 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys-bsd.c,v 1.33 2000/04/12 10:38:46 itojun Exp $ */
+/* $NetBSD: sys-bsd.c,v 1.34 2000/04/20 03:28:15 itojun Exp $ */
/*
* sys-bsd.c - System-dependent procedures for setting up
@@ -27,7 +27,7 @@
#if 0
#define RCSID "Id: sys-bsd.c,v 1.46 1999/08/13 06:46:18 paulus Exp "
#else
-__RCSID("$NetBSD: sys-bsd.c,v 1.33 2000/04/12 10:38:46 itojun Exp $");
+__RCSID("$NetBSD: sys-bsd.c,v 1.34 2000/04/20 03:28:15 itojun Exp $");
#endif
#endif
@@ -132,8 +132,10 @@
fatal("Couldn't create IP socket: %m");
#ifdef INET6
- if ((sock6_fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
- fatal("Couldn't create IPv6 socket: %m");
+ if ((sock6_fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
+ /* check it at runtime */
+ sock6_fd = -1;
+ }
#endif
FD_ZERO(&in_fds);
@@ -499,6 +501,11 @@
int ifindex;
struct in6_aliasreq addreq6;
+ if (sock6_fd < 0) {
+ fatal("No IPv6 socket available");
+ /*NOTREACHED*/
+ }
+
/* actually, this part is not kame local - RFC2553 conformant */
ifindex = if_nametoindex(ifname);
if (ifindex == 0) {
@@ -550,6 +557,11 @@
struct ifreq ifr;
struct in6_rtmsg rt6;
+ if (sock6_fd < 0) {
+ fatal("No IPv6 socket available");
+ /*NOTREACHED*/
+ }
+
memset(&ifr, 0, sizeof (ifr));
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(sock6_fd, SIOCGIFINDEX, (caddr_t) &ifr) < 0) {
@@ -598,6 +610,11 @@
int ifindex;
struct in6_ifreq delreq6;
+ if (sock6_fd < 0) {
+ fatal("No IPv6 socket available");
+ /*NOTREACHED*/
+ }
+
/* actually, this part is not kame local - RFC2553 conformant */
ifindex = if_nametoindex(ifname);
if (ifindex == 0) {
@@ -629,6 +646,11 @@
struct ifreq ifr;
struct in6_ifreq ifr6;
+ if (sock6_fd < 0) {
+ fatal("No IPv6 socket available");
+ /*NOTREACHED*/
+ }
+
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(sock6_fd, SIOCGIFINDEX, (caddr_t) &ifr) < 0) {
Home |
Main Index |
Thread Index |
Old Index