Implement LINUX_SIOCGIFCOUNT and LINUX_SIOCGIFINDEX/LINUX_SIOGIFINDEX.

LINUX_SIOCGIFCOUNT just returns 0 since it is not implemented in the
Linux 2.6.16.

LINUX_SIOCGIFINDEX/LINUX_SIOGIFINDEX are mapped to the FreeBSD native
SIOCGIFINDEX.

Tested by:	Peter Kostouros <kpeter@melbpc.org.au>
Reviewed by:	brooks, rpaulo (on net@)
Submitted by:	rdivacky
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2007-11-07 16:42:52 +00:00
parent e0350ca8f5
commit d60f0a3d6a
2 changed files with 15 additions and 1 deletions

View file

@ -2323,6 +2323,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
case LINUX_SIOCGIFCONF:
case LINUX_SIOCGPGRP:
case LINUX_SIOCSPGRP:
case LINUX_SIOCGIFCOUNT:
/* these ioctls don't take an interface name */
#ifdef DEBUG
printf("%s(): ioctl %d\n", __func__,
@ -2344,6 +2345,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
case LINUX_SIOCSIFHWADDR:
case LINUX_SIOCDEVPRIVATE:
case LINUX_SIOCDEVPRIVATE+1:
case LINUX_SIOCGIFINDEX:
/* copy in the interface name and translate it. */
error = copyin((void *)args->arg, lifname, LINUX_IFNAMSIZ);
if (error != 0)
@ -2478,6 +2480,15 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
error = ioctl(td, (struct ioctl_args *)args);
break;
case LINUX_SIOCGIFINDEX:
args->cmd = SIOCGIFINDEX;
error = ioctl(td, (struct ioctl_args *)args);
break;
case LINUX_SIOCGIFCOUNT:
error = 0;
break;
/*
* XXX This is slightly bogus, but these ioctls are currently
* XXX only used by the aironet (if_an) network driver.

View file

@ -230,9 +230,12 @@
#define LINUX_SIOCGIFHWADDR 0x8927
#define LINUX_SIOCADDMULTI 0x8931
#define LINUX_SIOCDELMULTI 0x8932
#define LINUX_SIOCGIFINDEX 0x8933
#define LINUX_SIOGIFINDEX LINUX_SIOCGIFINDEX
#define LINUX_SIOCGIFCOUNT 0x8938
#define LINUX_IOCTL_SOCKET_MIN LINUX_FIOSETOWN
#define LINUX_IOCTL_SOCKET_MAX LINUX_SIOCDELMULTI
#define LINUX_IOCTL_SOCKET_MAX LINUX_SIOCGIFCOUNT
/*
* Device private ioctl calls