static int get_ether_addr (u_int32_t ipaddr, struct sockaddr *hwaddr,
char *name);
static void decode_version (char *buf, int *version, int *mod, int *patch);
+static int set_kdebugflag(int level);
+static int ppp_registered(void);
extern u_char inpacket_buf[]; /* borrowed from main.c */
*
* sys_cleanup - restore any system state we modified before exiting:
* mark the interface down, delete default route and/or proxy arp entry.
- * This should call die() because it's called from die().
+ * This shouldn't call die() because it's called from die().
*/
void sys_cleanup(void)
closelog();
}
-/********************************************************************
- *
- * note_debug_level - note a change in the debug level.
- */
-
-void note_debug_level (void)
-{
- if (debug) {
- SYSDEBUG ((LOG_INFO, "Debug turned ON, Level %d", debug));
- setlogmask(LOG_UPTO(LOG_DEBUG));
- }
- else {
- setlogmask(LOG_UPTO(LOG_WARNING));
- }
-}
-
/********************************************************************
*
* set_kdebugflag - Define the debugging level for the kernel
*/
-int set_kdebugflag (int requested_level)
+static int set_kdebugflag (int requested_level)
{
if (ioctl(ppp_fd, PPPIOCSDEBUG, &requested_level) < 0) {
if ( ! ok_error (errno) )
fatal("tcsetattr: %m");
baud_rate = baud_rate_of(speed);
- restore_term = TRUE;
+ restore_term = 1;
}
/********************************************************************
* Set the MTU and other parameters for the ppp device
*/
memset (&ifr, '\0', sizeof (ifr));
- strlcpy(ifr.ifr_name, sizeof (ifr.ifr_name), ifname);
+ strlcpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
ifr.ifr_mtu = mtu;
if (ioctl(sock_fd, SIOCSIFMTU, (caddr_t) &ifr) < 0)
fp = fopen(MOUNTED, "r");
if (fp == NULL) {
/* Default the mount location of /proc */
- strlcpy (route_buffer, sizeof (route_buffer), "/proc");
+ strlcpy (route_buffer, "/proc", sizeof (route_buffer));
return 1;
}
if (mntent == 0)
return 0;
- strlcpy(route_buffer, sizeof (route_buffer), mntent->mnt_dir);
+ strlcpy(route_buffer, mntent->mnt_dir, sizeof (route_buffer));
return 1;
}
error("proc file system not mounted");
return 0;
}
- strlcat (route_buffer, sizeof(route_buffer), "/net/route");
+ strlcat (route_buffer, "/net/route", sizeof(route_buffer));
return (route_buffer);
}
for (ifr = ifc.ifc_req; ifr < ifend; ifr++) {
if (ifr->ifr_addr.sa_family == AF_INET) {
ina = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr.s_addr;
- strlcpy(ifreq.ifr_name, sizeof(ifreq.ifr_name), ifr->ifr_name);
+ strlcpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name));
SYSDEBUG ((LOG_DEBUG, "proxy arp: examining interface %s",
ifreq.ifr_name));
/*
/*
* Check that the interface is up, and not point-to-point nor loopback.
*/
- strlcpy(ifreq.ifr_name, sizeof(ifreq.ifr_name), ifr->ifr_name);
+ strlcpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name));
if (ioctl(sock_fd, SIOCGIFFLAGS, &ifreq) < 0)
continue;
* Procedure to determine if the PPP line discipline is registered.
*/
-int
+static int
ppp_registered(void)
{
int local_fd;
if (s < 0)
return 0;
- strlcpy (ifr.ifr_name, sizeof (ifr.ifr_name), "ppp0");
+ strlcpy (ifr.ifr_name, "ppp0", sizeof (ifr.ifr_name));
ok = ioctl(s, SIOCGIFFLAGS, (caddr_t) &ifr) >= 0;
/*
* If the device did not exist then attempt to create one by putting the
*/
if (!ok) {
if (ppp_registered()) {
- strlcpy (ifr.ifr_name, sizeof (ifr.ifr_name), "ppp0");
+ strlcpy (ifr.ifr_name, "ppp0", sizeof (ifr.ifr_name));
ok = ioctl(s, SIOCGIFFLAGS, (caddr_t) &ifr) >= 0;
}
}
memset(&ut, 0, sizeof(ut));
if (ut.ut_id[0] == 0)
- strlcpy(ut.ut_id, sizeof(ut.ut_id), line + 3);
+ strlcpy(ut.ut_id, line + 3, sizeof(ut.ut_id));
- strlcpy(ut.ut_user, sizeof(ut.ut_user), name);
- strlcpy(ut.ut_line, sizeof(ut.ut_line), line);
+ strlcpy(ut.ut_user, name, sizeof(ut.ut_user));
+ strlcpy(ut.ut_line, line, sizeof(ut.ut_line));
time(&ut.ut_time);
/* Insert the host name if one is supplied */
if (*host)
- strlcpy (ut.ut_host, sizeof(ut.ut_host), host);
+ strlcpy (ut.ut_host, host, sizeof(ut.ut_host));
/* Insert the IP address of the remote system if IP is enabled */
if (ipcp_protent.enabled_flag && ipcp_hisoptions[0].neg_addr)
struct ifreq ifr;
memset (&ifr, '\0', sizeof (ifr));
- strlcpy(ifr.ifr_name, sizeof (ifr.ifr_name), ifname);
+ strlcpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
if (ioctl(sock_fd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
if (! ok_error (errno))
error("ioctl (SIOCGIFFLAGS): %m(%d)", errno);
if_is_up = 0;
memset (&ifr, '\0', sizeof (ifr));
- strlcpy(ifr.ifr_name, sizeof (ifr.ifr_name), ifname);
+ strlcpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
if (ioctl(sock_fd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
if (! ok_error (errno))
error("ioctl (SIOCGIFFLAGS): %m(%d)", errno);
SET_SA_FAMILY (ifr.ifr_dstaddr, AF_INET);
SET_SA_FAMILY (ifr.ifr_netmask, AF_INET);
- strlcpy (ifr.ifr_name, sizeof (ifr.ifr_name), ifname);
+ strlcpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
/*
* Set our IP address
*/
}
else {
memset (&ifr, '\0', sizeof (ifr));
- strlcpy (ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
+ strlcpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
memcpy (sipx->sipx_node, node, IPX_NODE_LEN);
sipx->sipx_family = AF_IPX;
}
else {
memset (&ifr, '\0', sizeof (ifr));
- strlcpy (ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
+ strlcpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
sipx->sipx_type = IPX_FRAME_ETHERII;
sipx->sipx_action = IPX_DLTITF;
*/
while (ipxcp_protent.enabled_flag) {
if (path_to_procfs()) {
- strlcat (route_buffer, sizeof(route_buffer), "/net/ipx_interface");
+ strlcat (route_buffer, "/net/ipx_interface", sizeof(route_buffer));
if (lstat (route_buffer, &stat_buf) >= 0)
break;
}