handle all cases of SIOCSIFFLAGS in the same place

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20554 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos
2007-04-04 12:53:27 +00:00
parent ca2aa96377
commit f03d121241
+19 -17
View File
@@ -328,26 +328,28 @@ datalink_control(net_domain *_domain, int32 option, void *value,
request.ifr_name); request.ifr_name);
if (interface != NULL) { if (interface != NULL) {
// filter out bringing the interface up or down // filter out bringing the interface up or down
if (option == SIOCSIFFLAGS if (option == SIOCSIFFLAGS) {
&& ((uint32)request.ifr_flags & IFF_UP) if (((uint32)request.ifr_flags & IFF_UP)
!= (interface->flags & IFF_UP)) { != (interface->flags & IFF_UP)) {
if ((interface->flags & IFF_UP) != 0) { if ((interface->flags & IFF_UP) != 0) {
// bring the interface down // bring the interface down
interface->flags &= ~(IFF_UP | IFF_LINK); interface->flags &= ~(IFF_UP | IFF_LINK);
interface->first_info->interface_down( interface->first_info->interface_down(
interface->first_protocol); interface->first_protocol);
} else { } else {
// bring it up // bring it up
status = interface->first_info->interface_up( status = interface->first_info->interface_up(
interface->first_protocol); interface->first_protocol);
if (status == B_OK) { if (status == B_OK) {
interface->flags |= IFF_UP interface->flags |= IFF_UP
| (interface->device->media & IFM_ACTIVE | (interface->device->media & IFM_ACTIVE
? IFF_LINK : 0); ? IFF_LINK : 0);
}
} }
} }
interface->flags |= (request.ifr_flags & ~(IFF_UP | IFF_LINK)); if (status == B_OK)
interface->flags |= request.ifr_flags & ~(IFF_UP | IFF_LINK);
} else { } else {
// pass the request into the datalink protocol stack // pass the request into the datalink protocol stack
status = interface->first_info->control( status = interface->first_info->control(