Add members ifr_buf, ifr_buflen to ifreq for specifying the location

and size of a userland buffer.  The kernel shall not copyout more
than ifr_buflen bytes to ifr_buf.  For future ioctls that use
ifr_buf and ifr_buflen instead of ifr_data, the kernel can return
a larger struct in the future than when the ioctl is introduced,
without breaking ABI compatibility, provided that the size, order,
and semantics of the fields at the front of the struct does not
change.
This commit is contained in:
dyoung 2005-07-27 06:36:15 +00:00
parent 4811c2fc79
commit 1d1035405a

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.h,v 1.110 2005/06/22 06:16:02 dyoung Exp $ */ /* $NetBSD: if.h,v 1.111 2005/07/27 06:36:15 dyoung Exp $ */
/*- /*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -534,6 +534,10 @@ struct ifreq {
int ifru_dlt; int ifru_dlt;
u_int ifru_value; u_int ifru_value;
caddr_t ifru_data; caddr_t ifru_data;
struct {
uint32_t b_buflen;
void *b_buf;
} ifru_b;
} ifr_ifru; } ifr_ifru;
#define ifr_addr ifr_ifru.ifru_addr /* address */ #define ifr_addr ifr_ifru.ifru_addr /* address */
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
@ -544,7 +548,11 @@ struct ifreq {
#define ifr_dlt ifr_ifru.ifru_dlt /* data link type (DLT_*) */ #define ifr_dlt ifr_ifru.ifru_dlt /* data link type (DLT_*) */
#define ifr_value ifr_ifru.ifru_value /* generic value */ #define ifr_value ifr_ifru.ifru_value /* generic value */
#define ifr_media ifr_ifru.ifru_metric /* media options (overload) */ #define ifr_media ifr_ifru.ifru_metric /* media options (overload) */
#define ifr_data ifr_ifru.ifru_data /* for use by interface */ #define ifr_data ifr_ifru.ifru_data /* for use by interface
* XXX deprecated
*/
#define ifr_buf ifr_ifru.ifru_b.b_buf /* new interface ioctls */
#define ifr_buflen ifr_ifru.ifru_b.b_buflen
}; };
struct ifcapreq { struct ifcapreq {