Date: Fri, 8 Sep 2000 13:38:07 -0700 (PDT) From: Jim.Pirzyk@disney.com To: FreeBSD-gnats-submit@freebsd.org Subject: kern/21132: kern.hostid 31bit field and not a 32bit field Message-ID: <200009082038.NAA00820@snoopy.fan.fa.disney.com>
next in thread | raw e-mail | index | archive | help
>Number: 21132
>Category: kern
>Synopsis: setting kern.hostid to 2887705710 fails.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Sep 08 13:40:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Jim Pirzyk
>Release: FreeBSD 4.1-RELEASE i386
>Organization:
>Environment:
Any standard 4.1 enviroment
>Description:
kern.hostid can only be set up to LONG_MAX
>How-To-Repeat:
sysctl -w kern.hostid=2887705710
>Fix:
*** sbin/sysctl/sysctl.c.orig Fri Sep 8 12:55:12 2000
--- sbin/sysctl/sysctl.c Fri Sep 8 13:03:46 2000
***************
*** 121,127 ****
{
int len, i, j;
void *newval = 0;
! int intval, newsize = 0;
quad_t quadval;
int mib[CTL_MAXNAME];
char *cp, *bufp, buf[BUFSIZ];
--- 122,128 ----
{
int len, i, j;
void *newval = 0;
! unsigned int intval, newsize = 0;
quad_t quadval;
int mib[CTL_MAXNAME];
char *cp, *bufp, buf[BUFSIZ];
***************
*** 167,173 ****
switch (kind & CTLTYPE) {
case CTLTYPE_INT:
! intval = (int) strtol(newval, NULL, 0);
newval = &intval;
newsize = sizeof intval;
break;
--- 168,174 ----
switch (kind & CTLTYPE) {
case CTLTYPE_INT:
! intval = (unsigned int) strtoul(newval, NULL, 0);
newval = &intval;
newsize = sizeof intval;
break;
*** sys/kern/kern_mib.c.orig Fri Sep 8 12:17:20 2000
--- sys/kern/kern_mib.c Fri Sep 8 12:29:55 2000
***************
*** 186,194 ****
SYSCTL_STRING(_kern, KERN_NISDOMAINNAME, domainname, CTLFLAG_RW,
&domainname, sizeof(domainname), "Name of the current YP/NIS domain");
! long hostid;
/* Some trouble here, if sizeof (int) != sizeof (long) */
! SYSCTL_INT(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "Host ID");
/*
* This is really cheating. These actually live in the libc, something
--- 186,194 ----
SYSCTL_STRING(_kern, KERN_NISDOMAINNAME, domainname, CTLFLAG_RW,
&domainname, sizeof(domainname), "Name of the current YP/NIS domain");
! unsigned long hostid;
/* Some trouble here, if sizeof (int) != sizeof (long) */
! SYSCTL_UINT(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "Host ID");
/*
* This is really cheating. These actually live in the libc, something
*** sys/kern/kern_xxx.c.orig Fri Sep 8 12:35:33 2000
--- sys/kern/kern_xxx.c Fri Sep 8 12:36:17 2000
***************
*** 103,109 ****
struct ogethostid_args *uap;
{
! *(long *)(p->p_retval) = hostid;
return (0);
}
#endif /* COMPAT_43 || COMPAT_SUNOS */
--- 103,109 ----
struct ogethostid_args *uap;
{
! *(unsigned long *)(p->p_retval) = hostid;
return (0);
}
#endif /* COMPAT_43 || COMPAT_SUNOS */
***************
*** 111,117 ****
#ifdef COMPAT_43
#ifndef _SYS_SYSPROTO_H_
struct osethostid_args {
! long hostid;
};
#endif
/* ARGSUSED */
--- 111,117 ----
#ifdef COMPAT_43
#ifndef _SYS_SYSPROTO_H_
struct osethostid_args {
! unsigned long hostid;
};
#endif
/* ARGSUSED */
*** sys/sys/kernel.h.orig Fri Sep 8 12:18:01 2000
--- sys/sys/kernel.h Fri Sep 8 12:18:12 2000
***************
*** 55,61 ****
/* Global variables for the kernel. */
/* 1.1 */
! extern long hostid;
extern char hostname[MAXHOSTNAMELEN];
extern int hostnamelen;
extern char domainname[MAXHOSTNAMELEN];
--- 55,61 ----
/* Global variables for the kernel. */
/* 1.1 */
! extern unsigned long hostid;
extern char hostname[MAXHOSTNAMELEN];
extern int hostnamelen;
extern char domainname[MAXHOSTNAMELEN];
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009082038.NAA00820>
