network/stack: Do not invoke SIOCGIFMEDIA but just return the already-fetched media.
This functionally disables most of the functionality of the BSD-style SIOCGIFMEDIA, but it was never used in userland (because if it had, it would have triggered SMAP violations in the compatibility layer.) SIOCGIFMEDIA returns BSD-style media values, which mostly overlap with Haiku ones but have a few differences still. These are taken care of in the compat layer by ETHER_GET_LINK_STATE, which is where this media value comes from, but are not by SIOCGIFMEDIA which just passes back whatever the drivers do. Fixes #17770, at least for ethernet drivers.
This commit is contained in:
@@ -922,19 +922,15 @@ interface_protocol_control(net_datalink_protocol* _protocol, int32 option,
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
struct ifmediareq request;
|
struct ifmediareq request;
|
||||||
if (user_memcpy(&request, argument, sizeof(ifmediareq)) != B_OK)
|
if (user_memcpy(&request, argument, sizeof(request)) != B_OK)
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
|
|
||||||
// TODO: see above.
|
// TODO: Support retrieving the media list?
|
||||||
if (interface->device->module->control(interface->device,
|
memset(&request, 0, sizeof(struct ifmediareq));
|
||||||
SIOCGIFMEDIA, &request,
|
request.ifm_active = request.ifm_current
|
||||||
sizeof(struct ifmediareq)) != B_OK) {
|
= interface->device->media;
|
||||||
memset(&request, 0, sizeof(struct ifmediareq));
|
|
||||||
request.ifm_active = request.ifm_current
|
|
||||||
= interface->device->media;
|
|
||||||
}
|
|
||||||
|
|
||||||
return user_memcpy(argument, &request, sizeof(struct ifmediareq));
|
return user_memcpy(argument, &request, sizeof(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
case SIOCGIFMETRIC:
|
case SIOCGIFMETRIC:
|
||||||
|
|||||||
@@ -472,14 +472,10 @@ link_control(net_protocol* _protocol, int level, int option, void* value,
|
|||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: see above.
|
// We do not support SIOCSIFMEDIA here, so ignore the media list.
|
||||||
if (interface->device->module->control(interface->device,
|
memset(&request, 0, sizeof(struct ifmediareq));
|
||||||
SIOCGIFMEDIA, &request,
|
request.ifm_active = request.ifm_current = interface->device->media;
|
||||||
sizeof(struct ifmediareq)) != B_OK) {
|
|
||||||
memset(&request, 0, sizeof(struct ifmediareq));
|
|
||||||
request.ifm_active = request.ifm_current
|
|
||||||
= interface->device->media;
|
|
||||||
}
|
|
||||||
put_device_interface(interface);
|
put_device_interface(interface);
|
||||||
|
|
||||||
return user_memcpy(value, &request, sizeof(struct ifmediareq));
|
return user_memcpy(value, &request, sizeof(struct ifmediareq));
|
||||||
|
|||||||
Reference in New Issue
Block a user