/*
* System-dependent procedures for pppd under Digital UNIX (OSF/1).
*
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
+ * Copyright (c) 1994-2002 Paul Mackerras. All rights reserved.
*
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
*
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
*
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
+ * 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. The name(s) of the authors of this software must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission.
+ *
+ * 4. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by Paul Mackerras
+ * <paulus@samba.org>".
+ *
+ * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Derived from main.c and pppd.h, which are:
+ *
+ * Copyright (c) 1984-2000 Carnegie Mellon University. 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. The name "Carnegie Mellon University" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For permission or any legal
+ * details, please contact
+ * Office of Technology Transfer
+ * Carnegie Mellon University
+ * 5000 Forbes Avenue
+ * Pittsburgh, PA 15213-3890
+ * (412) 268-4387, fax: (412) 268-7395
+ * tech-transfer@andrew.cmu.edu
+ *
+ * 4. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by Computing Services
+ * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
+ *
+ * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define RCSID "$Id: sys-osf.c,v 1.30 1999/08/13 06:46:18 paulus Exp $"
+#define RCSID "$Id: sys-osf.c,v 1.32 2002/12/04 23:03:33 paulus Exp $"
+#include <syslog.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
wait_input(timo);
}
+#endif
+
/*
* wait_time - wait for a given length of time or until a
- * signal is received.
+ * signal is received. Called by ccp_test
*/
-void
+static void
wait_time(timo)
struct timeval *timo;
{
if (n < 0 && errno != EINTR)
fatal("select: %m");
}
-#endif
/*
* read_packet - get a PPP packet from the serial device.
*/
int have_route_to(u_int32_t addr)
{
- char buf[sizeof(struct rt_msghdr) + (sizeof(struct sockaddr_in))];
- int status;
- int s, n;
- struct rt_msghdr *rtm;
- struct sockaddr_in *sin;
- int msglen = sizeof(*rtm) + (sizeof(*sin));
- char *cp;
- char msg[2048];
-
- rtm = (struct rt_msghdr *)buf;
- memset(rtm, 0, msglen);
- rtm->rtm_msglen = msglen;
- rtm->rtm_version = RTM_VERSION;
- rtm->rtm_type = RTM_GET;
- rtm->rtm_addrs = RTA_DST;
- /* rtm->rtm_addrs, rtm_flags should be set on output */
-
- sin = (struct sockaddr_in *)((u_char *)rtm + sizeof(*rtm));
- sin->sin_len = sizeof(*sin);
- sin->sin_family = AF_INET;
- sin->sin_addr.s_addr = addr;
-
- status = 0;
-
- if ((s = socket(PF_ROUTE, SOCK_RAW, 0)) < 0)
- return -1;
- if (write(s, (char *)rtm, msglen) != msglen) {
- close(s);
- return status == ESRCH? 0: -1;
- }
-
- n = read(s, msg, 2048);
- close(s);
- if (n <= 0)
- return -1;
-
- rtm = (struct rt_msghdr *) msg;
- if (rtm->rtm_version != RTM_VERSION)
- return -1;
-
- /* here we try to work out if the route is through our own interface */
- cp = (char *)(rtm + 1);
- if (rtm->rtm_addrs & RTA_DST) {
- struct sockaddr *sa = (struct sockaddr *) cp;
- cp = (char *)(((unsigned long)cp + sa->sa_len
- + sizeof(long) - 1) & ~(sizeof(long) - 1));
- }
- if (rtm->rtm_addrs & RTA_GATEWAY) {
- sin = (struct sockaddr_in *) cp;
- if (sin->sin_addr.s_addr == ifaddrs[0]
- || sin->sin_addr.s_addr == ifaddrs[1])
- return 0; /* route is through our interface */
- }
-
- return 1;
+ return -1;
}
static int