SCCS-vsn: usr.sbin/sendmail/src/conf.h 8.161
SCCS-vsn: usr.sbin/sendmail/src/daemon.c 8.89
SCCS-vsn: usr.sbin/sendmail/src/conf.c 8.168
-static char sccsid[] = "@(#)conf.c 8.167 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c 8.168 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
load_if_names()
{
#ifdef SIOCGIFCONF
load_if_names()
{
#ifdef SIOCGIFCONF
- int n;
- extern char *inet_ntoa();
- extern struct hostent *gethostbyaddr();
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s == -1)
return;
/* get the list of known IP address from the kernel */
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s == -1)
return;
/* get the list of known IP address from the kernel */
- ifc.ifc_len = sizeof(interfacebuf);
ifc.ifc_buf = interfacebuf;
ifc.ifc_buf = interfacebuf;
+ ifc.ifc_len = sizeof interfacebuf;
if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0)
{
if (tTd(0, 4))
printf("SIOGIFCONF failed: %s\n", errstring(errno));
if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0)
{
if (tTd(0, 4))
printf("SIOGIFCONF failed: %s\n", errstring(errno));
/* scan the list of IP address */
if (tTd(0, 4))
printf("scanning for interface specific names, ifc_len=%d\n",
ifc.ifc_len);
/* scan the list of IP address */
if (tTd(0, 4))
printf("scanning for interface specific names, ifc_len=%d\n",
ifc.ifc_len);
- ifr = ifc.ifc_req;
- for (n = ifc.ifc_len / sizeof(struct ifreq); n > 0; n--, ifr++)
- {
+ for (i = 0; i < ifc.ifc_len; )
+ {
+ struct ifreq *ifr = (struct ifreq *) &ifc.ifc_buf[i];
+ struct sockaddr *sa = &ifr->ifr_addr;
+ extern char *inet_ntoa();
+ extern struct hostent *gethostbyaddr();
+
+#ifdef BSD4_4_SOCKADDR
+ if (sa->sa_len > sizeof ifr->ifr_addr)
+ i += sizeof ifr->ifr_name + sa->sa_len;
+ else
+#endif
+ i += sizeof *ifr;
- printf("%s\n", anynet_ntoa((SOCKADDR *) &ifr->ifr_addr));
+ printf("%s\n", anynet_ntoa((SOCKADDR *) sa));
if (ifr->ifr_addr.sa_family != AF_INET)
continue;
/* extract IP address from the list*/
if (ifr->ifr_addr.sa_family != AF_INET)
continue;
/* extract IP address from the list*/
- ia = (((struct sockaddr_in *) (&ifr->ifr_addr))->sin_addr);
+ ia = (((struct sockaddr_in *) sa)->sin_addr);
/* save IP address in text from */
(void) sprintf(ip_addr, "[%s]",
/* save IP address in text from */
(void) sprintf(ip_addr, "[%s]",
- inet_ntoa(((struct sockaddr_in *)(&ifr->ifr_addr))->sin_addr));
+ inet_ntoa(((struct sockaddr_in *) sa)->sin_addr));
if (!wordinclass(ip_addr, 'w'))
{
setclass('w', ip_addr);
if (!wordinclass(ip_addr, 'w'))
{
setclass('w', ip_addr);
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)conf.h 8.160 (Berkeley) %G%
+ * @(#)conf.h 8.161 (Berkeley) %G%
# define HASUNSETENV 1 /* has unsetenv(3) call */
# include <sys/cdefs.h>
# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
# define HASUNSETENV 1 /* has unsetenv(3) call */
# include <sys/cdefs.h>
# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
+# define BSD4_4_SOCKADDR /* has sa_len */
# ifndef LA_TYPE
# define LA_TYPE LA_SUBR
# endif
# ifndef LA_TYPE
# define LA_TYPE LA_SUBR
# endif
# define HASSETSID 1 /* has the setsid(2) POSIX syscall */
# include <sys/cdefs.h>
# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
# define HASSETSID 1 /* has the setsid(2) POSIX syscall */
# include <sys/cdefs.h>
# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
+# define BSD4_4_SOCKADDR /* has sa_len */
# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
# ifndef LA_TYPE
# define LA_TYPE LA_SUBR
# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
# ifndef LA_TYPE
# define LA_TYPE LA_SUBR
# endif
# include <sys/cdefs.h>
# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
# endif
# include <sys/cdefs.h>
# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
+# define BSD4_4_SOCKADDR /* has sa_len */
# ifndef LA_TYPE
# define LA_TYPE LA_SUBR
# endif
# ifndef LA_TYPE
# define LA_TYPE LA_SUBR
# endif
#ifndef lint
#ifdef DAEMON
#ifndef lint
#ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c 8.88 (Berkeley) %G% (with daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.89 (Berkeley) %G% (with daemon mode)";
-static char sccsid[] = "@(#)daemon.c 8.88 (Berkeley) %G% (without daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.89 (Berkeley) %G% (without daemon mode)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
** A printable version of that sockaddr.
*/
** A printable version of that sockaddr.
*/
+#ifdef AF_LINK
+# include <net/if_dl.h>
+#endif
+
char *
anynet_ntoa(sap)
register SOCKADDR *sap;
char *
anynet_ntoa(sap)
register SOCKADDR *sap;
return inet_ntoa(sap->sin.sin_addr);
#endif
return inet_ntoa(sap->sin.sin_addr);
#endif
+#ifdef AF_LINK
+ case AF_LINK:
+ sprintf(buf, "[LINK: %s]",
+ link_ntoa((struct sockaddr_dl *) &sap->sa));
+ return buf;
+#endif
- /* this case is only to ensure syntactic correctness */
- break;
+ /* this case is needed when nothing is #defined */
+ /* in order to keep the switch syntactically correct */
+ break;
}
/* unknown family -- just dump bytes */
}
/* unknown family -- just dump bytes */