* datalink_control() also need to accept structures smaller than ifreq as long
as the interface name can be specified. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38015 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
c968ec1c41
commit
e8802e499c
@ -309,12 +309,15 @@ datalink_control(net_domain* _domain, int32 option, void* value,
|
||||
|
||||
default:
|
||||
{
|
||||
if (*_length < sizeof(struct ifreq))
|
||||
// We also accept partial ifreqs as long as the name is complete.
|
||||
if (*_length < IF_NAMESIZE)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
size_t length = min_c(sizeof(struct ifreq), *_length);
|
||||
|
||||
// try to pass the request to an existing interface
|
||||
struct ifreq request;
|
||||
if (user_memcpy(&request, value, sizeof(struct ifreq)) < B_OK)
|
||||
if (user_memcpy(&request, value, length) != B_OK)
|
||||
return B_BAD_ADDRESS;
|
||||
|
||||
Interface* interface = get_interface(domain, request.ifr_name);
|
||||
|
@ -649,6 +649,9 @@ Interface::Control(net_domain* domain, int32 option, ifreq& request,
|
||||
switch (option) {
|
||||
case SIOCSIFFLAGS:
|
||||
{
|
||||
if (length != sizeof(ifreq))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
uint32 requestFlags = request.ifr_flags;
|
||||
uint32 oldFlags = flags;
|
||||
status_t status = B_OK;
|
||||
@ -677,6 +680,9 @@ Interface::Control(net_domain* domain, int32 option, ifreq& request,
|
||||
|
||||
case B_SOCKET_SET_ALIAS:
|
||||
{
|
||||
if (length != sizeof(ifaliasreq))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
RecursiveLocker locker(fLock);
|
||||
|
||||
ifaliasreq aliasRequest;
|
||||
@ -726,6 +732,9 @@ Interface::Control(net_domain* domain, int32 option, ifreq& request,
|
||||
case SIOCSIFDSTADDR:
|
||||
case SIOCDIFADDR:
|
||||
{
|
||||
if (length != sizeof(ifreq))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
RecursiveLocker locker(fLock);
|
||||
|
||||
InterfaceAddress* address = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user