1999-02-19 03:21:36 +03:00
/*
* Copyright ( c ) 1993 , 1994 , 1995 , 1996 Rick Sladkey < jrs @ world . std . com >
* 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 of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission .
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` ` AS IS ' ' AND ANY EXPRESS OR
* IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED .
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT , INDIRECT ,
* INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT
* NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE ,
* DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT
* ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
*
* $ Id $
*/
# include "defs.h"
2003-04-02 05:10:44 +04:00
# ifdef LINUX
1999-02-19 03:21:36 +03:00
# include <sys/socket.h>
2004-07-12 11:13:06 +04:00
# include <linux/sockios.h>
1999-02-19 03:21:36 +03:00
# else
2004-10-20 03:33:50 +04:00
# include <sys/socket.h>
1999-02-19 03:21:36 +03:00
# include <sys/sockio.h>
# endif
2004-07-12 11:13:06 +04:00
# include <arpa/inet.h>
1999-02-19 03:21:36 +03:00
2003-06-27 02:40:42 +04:00
# if defined (ALPHA) || defined(SH) || defined(SH64)
1999-05-09 04:29:58 +04:00
# ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
# elif defined(HAVE_IOCTLS_H)
1999-02-19 03:21:36 +03:00
# include <ioctls.h>
# endif
1999-05-09 04:29:58 +04:00
# endif
2004-07-12 11:13:06 +04:00
# include <net/if.h>
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
static const struct xlat iffflags [ ] = {
{ IFF_UP , " IFF_UP " } ,
{ IFF_BROADCAST , " IFF_BROADCAST " } ,
{ IFF_DEBUG , " IFF_DEBUG " } ,
{ IFF_LOOPBACK , " IFF_LOOPBACK " } ,
{ IFF_POINTOPOINT , " IFF_POINTOPOINT " } ,
{ IFF_NOTRAILERS , " IFF_NOTRAILERS " } ,
{ IFF_RUNNING , " IFF_RUNNING " } ,
{ IFF_NOARP , " IFF_NOARP " } ,
{ IFF_PROMISC , " IFF_PROMISC " } ,
{ IFF_ALLMULTI , " IFF_ALLMULTI " } ,
{ IFF_MASTER , " IFF_MASTER " } ,
{ IFF_SLAVE , " IFF_SLAVE " } ,
{ IFF_MULTICAST , " IFF_MULTICAST " } ,
{ IFF_PORTSEL , " IFF_PORTSEL " } ,
{ IFF_AUTOMEDIA , " IFF_AUTOMEDIA " } ,
{ 0 , NULL }
} ;
static void
2011-05-30 16:00:14 +04:00
print_addr ( struct tcb * tcp , long addr , struct ifreq * ifr )
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
{
if ( ifr - > ifr_addr . sa_family = = AF_INET ) {
struct sockaddr_in * sinp ;
sinp = ( struct sockaddr_in * ) & ifr - > ifr_addr ;
tprintf ( " inet_addr( \" %s \" ) " , inet_ntoa ( sinp - > sin_addr ) ) ;
} else
printstr ( tcp , addr , sizeof ( ifr - > ifr_addr . sa_data ) ) ;
}
1999-02-19 03:21:36 +03:00
int
2007-03-21 16:52:14 +03:00
sock_ioctl ( struct tcb * tcp , long code , long arg )
1999-02-19 03:21:36 +03:00
{
2004-07-12 11:13:06 +04:00
struct ifreq ifr ;
struct ifconf ifc ;
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
const char * str = NULL ;
unsigned char * bytes ;
2004-07-12 11:13:06 +04:00
if ( entering ( tcp ) ) {
if ( code = = SIOCGIFCONF ) {
2007-03-21 17:18:17 +03:00
if ( umove ( tcp , tcp - > u_arg [ 2 ] , & ifc ) > = 0
& & ifc . ifc_buf = = NULL )
2004-07-12 11:13:06 +04:00
tprintf ( " , {%d -> " , ifc . ifc_len ) ;
else
2011-09-01 12:00:28 +04:00
tprints ( " , { " ) ;
2004-07-12 11:13:06 +04:00
}
1999-02-19 03:21:36 +03:00
return 0 ;
2004-07-12 11:13:06 +04:00
}
1999-02-19 03:21:36 +03:00
switch ( code ) {
# ifdef SIOCSHIWAT
case SIOCSHIWAT :
# endif
# ifdef SIOCGHIWAT
case SIOCGHIWAT :
# endif
# ifdef SIOCSLOWAT
case SIOCSLOWAT :
# endif
# ifdef SIOCGLOWAT
case SIOCGLOWAT :
# endif
# ifdef FIOSETOWN
case FIOSETOWN :
# endif
# ifdef FIOGETOWN
case FIOGETOWN :
# endif
# ifdef SIOCSPGRP
case SIOCSPGRP :
# endif
# ifdef SIOCGPGRP
case SIOCGPGRP :
# endif
# ifdef SIOCATMARK
case SIOCATMARK :
# endif
printnum ( tcp , arg , " , %#d " ) ;
return 1 ;
2004-07-12 11:13:06 +04:00
# ifdef LINUX
case SIOCGIFNAME :
2008-12-10 16:51:40 +03:00
case SIOCSIFNAME :
2004-07-12 11:13:06 +04:00
case SIOCGIFINDEX :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
case SIOCGIFADDR :
2008-12-10 16:51:40 +03:00
case SIOCSIFADDR :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
case SIOCGIFDSTADDR :
2008-12-10 16:51:40 +03:00
case SIOCSIFDSTADDR :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
case SIOCGIFBRDADDR :
2008-12-10 16:51:40 +03:00
case SIOCSIFBRDADDR :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
case SIOCGIFNETMASK :
2008-12-10 16:51:40 +03:00
case SIOCSIFNETMASK :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
case SIOCGIFFLAGS :
2008-12-10 16:51:40 +03:00
case SIOCSIFFLAGS :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
case SIOCGIFMETRIC :
2008-12-10 16:51:40 +03:00
case SIOCSIFMETRIC :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
case SIOCGIFMTU :
2008-12-10 16:51:40 +03:00
case SIOCSIFMTU :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
case SIOCGIFSLAVE :
2008-12-10 16:51:40 +03:00
case SIOCSIFSLAVE :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
case SIOCGIFHWADDR :
2008-12-10 16:51:40 +03:00
case SIOCSIFHWADDR :
2007-03-21 16:52:14 +03:00
case SIOCGIFTXQLEN :
2008-12-10 16:51:40 +03:00
case SIOCSIFTXQLEN :
2007-03-21 16:57:50 +03:00
case SIOCGIFMAP :
2008-12-10 16:51:40 +03:00
case SIOCSIFMAP :
2007-03-21 17:18:17 +03:00
if ( umove ( tcp , tcp - > u_arg [ 2 ] , & ifr ) < 0 )
tprintf ( " , %#lx " , tcp - > u_arg [ 2 ] ) ;
else if ( syserror ( tcp ) ) {
2008-12-10 16:51:40 +03:00
if ( code = = SIOCGIFNAME | | code = = SIOCSIFNAME )
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
tprintf ( " , {ifr_index=%d, ifr_name=???} " , ifr . ifr_ifindex ) ;
else
tprintf ( " , {ifr_name= \" %s \" , ???} " , ifr . ifr_name ) ;
2008-12-10 16:51:40 +03:00
} else if ( code = = SIOCGIFNAME | | code = = SIOCSIFNAME )
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
tprintf ( " , {ifr_index=%d, ifr_name= \" %s \" } " ,
2004-07-12 11:13:06 +04:00
ifr . ifr_ifindex , ifr . ifr_name ) ;
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
else {
tprintf ( " , {ifr_name= \" %s \" , " , ifr . ifr_name ) ;
switch ( code ) {
case SIOCGIFINDEX :
tprintf ( " ifr_index=%d " , ifr . ifr_ifindex ) ;
break ;
case SIOCGIFADDR :
2008-12-10 16:51:40 +03:00
case SIOCSIFADDR :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
str = " ifr_addr " ;
case SIOCGIFDSTADDR :
2008-12-10 16:51:40 +03:00
case SIOCSIFDSTADDR :
if ( ! str )
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
str = " ifr_dstaddr " ;
case SIOCGIFBRDADDR :
2008-12-10 16:51:40 +03:00
case SIOCSIFBRDADDR :
if ( ! str )
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
str = " ifr_broadaddr " ;
case SIOCGIFNETMASK :
2008-12-10 16:51:40 +03:00
case SIOCSIFNETMASK :
if ( ! str )
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
str = " ifr_netmask " ;
tprintf ( " %s={ " , str ) ;
printxval ( addrfams ,
ifr . ifr_addr . sa_family ,
2008-12-30 21:47:55 +03:00
" AF_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
print_addr ( tcp , ( ( long ) tcp - > u_arg [ 2 ]
2011-06-07 14:13:24 +04:00
+ offsetof ( struct ifreq ,
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
ifr_addr . sa_data ) ) ,
& ifr ) ;
2011-09-01 12:00:28 +04:00
tprints ( " } " ) ;
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
break ;
case SIOCGIFHWADDR :
2008-12-10 16:51:40 +03:00
case SIOCSIFHWADDR :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
/* XXX Are there other hardware addresses
than 6 - byte MACs ? */
bytes = ( unsigned char * ) & ifr . ifr_hwaddr . sa_data ;
tprintf ( " ifr_hwaddr=%02x:%02x:%02x:%02x:%02x:%02x " ,
bytes [ 0 ] , bytes [ 1 ] , bytes [ 2 ] ,
bytes [ 3 ] , bytes [ 4 ] , bytes [ 5 ] ) ;
break ;
case SIOCGIFFLAGS :
2008-12-10 16:51:40 +03:00
case SIOCSIFFLAGS :
2011-09-01 12:00:28 +04:00
tprints ( " ifr_flags= " ) ;
2005-05-31 Dmitry V. Levin <ldv@altlinux.org>
* util.c (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument, "const char *", with similar
meaning to the third argument of printxval().
* defs.h (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument.
* bjm.c (sys_query_module) [LINUX]: Pass third argument to
printflags().
* desc.c (sys_fcntl): Likewise.
(sys_flock) [LOCK_SH]: Likewise.
(print_epoll_event) [HAVE_SYS_EPOLL_H]: Likewise.
* file.c (sys_open): Likewise.
(solaris_open) [LINUXSPARC]: Likewise.
(sys_access): Likewise.
(sys_chflags, sys_fchflags) [FREEBSD]: Likewise.
(realprintstat) [HAVE_LONG_LONG_OFF_T &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(printstat64) [HAVE_STAT64 &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(sys_setxattr, sys_fsetxattr): Likewise.
* ipc.c (sys_msgget, sys_msgsnd, sys_msgrcv, sys_semget,
sys_shmget, sys_shmat) [LINUX || SUNOS4 || FREEBSD]: Likewise.
(sys_mq_open) [LINUX]: Likewise.
(printmqattr) [HAVE_MQUEUE_H]: Likewise.
* mem.c (print_mmap) [!HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mmap64) [_LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mprotect): Likewise.
(sys_mremap, sys_madvise, sys_mlockall) [LINUX]: Likewise.
(sys_msync) [MS_ASYNC]: Likewise.
(sys_mctl) [MC_SYNC]: Likewise.
(sys_remap_file_pages, sys_mbind, sys_get_mempolicy) [LINUX]:
Likewise.
* net.c (printmsghdr) [HAVE_STRUCT_MSGHDR_MSG_CONTROL]: Likewise.
(sys_send, sys_sendto): Likewise.
(sys_sendmsg) [HAVE_SENDMSG]: Likewise.
(sys_recv, sys_recvfrom): Likewise.
(sys_recvmsg) [HAVE_SENDMSG]: Likewise.
(printicmpfilter) [ICMP_FILTER]: Likewise.
* proc.c (proc_ioctl) [SVR4 && !HAVE_MP_PROCFS || FREEBSD]: Likewise.
* process.c (sys_clone) [LINUX]: Likewise.
(printwaitn): Likewise.
(sys_waitid) [SVR4 || LINUX]: Likewise.
* signal.c (sys_sigvec) [SUNOS4 || FREEBSD]: Likewise.
(sys_sigaction): Likewise.
(printcontext) [SVR4]: Likewise.
(print_stack_t) [LINUX) || FREEBSD]: Likewise.
(sys_rt_sigaction) [LINUX]: Likewise.
* sock.c (sock_ioctl) [LINUX]: Likewise.
* stream.c (sys_putmsg, sys_getmsg): Likewise.
(sys_putpmsg) [SYS_putpmsg]: Likewise.
(sys_getpmsg) [SYS_getpmsg]: Likewise.
(sys_poll): Likewise.
(print_transport_message) [TI_BIND]: Likewise.
(stream_ioctl): Likewise.
* system.c (sys_mount, sys_reboot): Likewise.
(sys_cacheflush) [LINUX && M68K]: Likewise.
(sys_capget, sys_capset) [SYS_capget]: Likewise.
* term.c (term_ioctl) [TIOCMGET]: Likewise.
* time.c (sys_clock_nanosleep, sys_timer_settime) [LINUX]:
Likewise.
Fixes RH#159310.
2005-06-01 23:02:36 +04:00
printflags ( iffflags , ifr . ifr_flags , " IFF_??? " ) ;
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
break ;
case SIOCGIFMETRIC :
2008-12-10 16:51:40 +03:00
case SIOCSIFMETRIC :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
tprintf ( " ifr_metric=%d " , ifr . ifr_metric ) ;
break ;
case SIOCGIFMTU :
2008-12-10 16:51:40 +03:00
case SIOCSIFMTU :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
tprintf ( " ifr_mtu=%d " , ifr . ifr_mtu ) ;
break ;
case SIOCGIFSLAVE :
2008-12-10 16:51:40 +03:00
case SIOCSIFSLAVE :
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
tprintf ( " ifr_slave= \" %s \" " , ifr . ifr_slave ) ;
break ;
2007-03-21 16:52:14 +03:00
case SIOCGIFTXQLEN :
2008-12-10 16:51:40 +03:00
case SIOCSIFTXQLEN :
2007-03-21 16:52:14 +03:00
tprintf ( " ifr_qlen=%d " , ifr . ifr_qlen ) ;
break ;
2007-03-21 16:57:50 +03:00
case SIOCGIFMAP :
2008-12-10 16:51:40 +03:00
case SIOCSIFMAP :
2007-03-21 16:57:50 +03:00
tprintf ( " ifr_map={mem_start=%#lx, "
" mem_end=%#lx, base_addr=%#x, "
" irq=%u, dma=%u, port=%u} " ,
ifr . ifr_map . mem_start ,
ifr . ifr_map . mem_end ,
( unsigned ) ifr . ifr_map . base_addr ,
( unsigned ) ifr . ifr_map . irq ,
( unsigned ) ifr . ifr_map . dma ,
( unsigned ) ifr . ifr_map . port ) ;
break ;
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
}
2011-09-01 12:00:28 +04:00
tprints ( " } " ) ;
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
}
2004-07-12 11:13:06 +04:00
return 1 ;
case SIOCGIFCONF :
2007-03-21 17:18:17 +03:00
if ( umove ( tcp , tcp - > u_arg [ 2 ] , & ifc ) < 0 ) {
2011-09-01 12:00:28 +04:00
tprints ( " ???} " ) ;
2007-03-21 17:18:17 +03:00
return 1 ;
}
2004-07-12 11:13:06 +04:00
tprintf ( " %d, " , ifc . ifc_len ) ;
2008-12-30 21:47:55 +03:00
if ( syserror ( tcp ) ) {
2004-07-12 11:13:06 +04:00
tprintf ( " %lx " , ( unsigned long ) ifc . ifc_buf ) ;
} else if ( ifc . ifc_buf = = NULL ) {
2011-09-01 12:00:28 +04:00
tprints ( " NULL " ) ;
2004-07-12 11:13:06 +04:00
} else {
int i ;
unsigned nifra = ifc . ifc_len / sizeof ( struct ifreq ) ;
struct ifreq ifra [ nifra ] ;
2009-11-03 17:38:44 +03:00
if ( umoven ( tcp , ( unsigned long ) ifc . ifc_buf ,
sizeof ( ifra ) , ( char * ) ifra ) < 0 ) {
tprintf ( " %lx} " , ( unsigned long ) ifc . ifc_buf ) ;
return 1 ;
}
2011-09-01 12:00:28 +04:00
tprints ( " { " ) ;
2004-07-12 11:13:06 +04:00
for ( i = 0 ; i < nifra ; + + i ) {
if ( i > 0 )
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2004-07-12 11:13:06 +04:00
tprintf ( " { \" %s \" , { " ,
ifra [ i ] . ifr_name ) ;
if ( verbose ( tcp ) ) {
printxval ( addrfams ,
ifra [ i ] . ifr_addr . sa_family ,
" AF_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
print_addr ( tcp , ( ( long ) tcp - > u_arg [ 2 ]
2011-06-07 14:13:24 +04:00
+ offsetof ( struct ifreq ,
2005-02-02 Roland McGrath <roland@redhat.com>
* sock.c (iffflags): New variable, table of IFF_* values.
(print_addr): New function.
(sock_ioctl): Handle SIOCGIFADDR, SIOCGIFDSTADDR, SIOCGIFBRDADDR,
SIOCGIFNETMASK, SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFSLAVE,
SIOCGIFHWADDR. Use print_addr for SIOCGIFCONF, SIOCGIFNAME, and
SIOCGIFINDEX, and fix their output.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#138223.
2005-02-02 23:25:17 +03:00
ifr_addr . sa_data )
+ ( ( char * ) & ifra [ i ]
- ( char * ) & ifra [ 0 ] ) ) ,
& ifra [ i ] ) ;
2004-07-12 11:13:06 +04:00
} else
2011-09-01 12:00:28 +04:00
tprints ( " ... " ) ;
tprints ( " }} " ) ;
2004-07-12 11:13:06 +04:00
}
2011-09-01 12:00:28 +04:00
tprints ( " } " ) ;
2004-07-12 11:13:06 +04:00
}
2011-09-01 12:00:28 +04:00
tprints ( " } " ) ;
2004-07-12 11:13:06 +04:00
return 1 ;
# endif
1999-02-19 03:21:36 +03:00
default :
return 0 ;
}
}
2012-02-20 21:02:38 +04:00
int
sys_socketcall ( struct tcb * tcp )
{
return printargs ( tcp ) ;
}