diff options
Diffstat (limited to 'net/batman-adv/bat_sysfs.c')
-rw-r--r-- | net/batman-adv/bat_sysfs.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c index 93ae20aaad0a..e449bf6353e0 100644 --- a/net/batman-adv/bat_sysfs.c +++ b/net/batman-adv/bat_sysfs.c | |||
@@ -441,16 +441,16 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr, | |||
441 | char *buff) | 441 | char *buff) |
442 | { | 442 | { |
443 | struct net_device *net_dev = kobj_to_netdev(kobj); | 443 | struct net_device *net_dev = kobj_to_netdev(kobj); |
444 | struct batman_if *batman_if = get_batman_if_by_netdev(net_dev); | 444 | struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev); |
445 | ssize_t length; | 445 | ssize_t length; |
446 | 446 | ||
447 | if (!batman_if) | 447 | if (!hard_iface) |
448 | return 0; | 448 | return 0; |
449 | 449 | ||
450 | length = sprintf(buff, "%s\n", batman_if->if_status == IF_NOT_IN_USE ? | 450 | length = sprintf(buff, "%s\n", hard_iface->if_status == IF_NOT_IN_USE ? |
451 | "none" : batman_if->soft_iface->name); | 451 | "none" : hard_iface->soft_iface->name); |
452 | 452 | ||
453 | hardif_free_ref(batman_if); | 453 | hardif_free_ref(hard_iface); |
454 | 454 | ||
455 | return length; | 455 | return length; |
456 | } | 456 | } |
@@ -459,11 +459,11 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr, | |||
459 | char *buff, size_t count) | 459 | char *buff, size_t count) |
460 | { | 460 | { |
461 | struct net_device *net_dev = kobj_to_netdev(kobj); | 461 | struct net_device *net_dev = kobj_to_netdev(kobj); |
462 | struct batman_if *batman_if = get_batman_if_by_netdev(net_dev); | 462 | struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev); |
463 | int status_tmp = -1; | 463 | int status_tmp = -1; |
464 | int ret = count; | 464 | int ret = count; |
465 | 465 | ||
466 | if (!batman_if) | 466 | if (!hard_iface) |
467 | return count; | 467 | return count; |
468 | 468 | ||
469 | if (buff[count - 1] == '\n') | 469 | if (buff[count - 1] == '\n') |
@@ -472,7 +472,7 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr, | |||
472 | if (strlen(buff) >= IFNAMSIZ) { | 472 | if (strlen(buff) >= IFNAMSIZ) { |
473 | pr_err("Invalid parameter for 'mesh_iface' setting received: " | 473 | pr_err("Invalid parameter for 'mesh_iface' setting received: " |
474 | "interface name too long '%s'\n", buff); | 474 | "interface name too long '%s'\n", buff); |
475 | hardif_free_ref(batman_if); | 475 | hardif_free_ref(hard_iface); |
476 | return -EINVAL; | 476 | return -EINVAL; |
477 | } | 477 | } |
478 | 478 | ||
@@ -481,28 +481,31 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr, | |||
481 | else | 481 | else |
482 | status_tmp = IF_I_WANT_YOU; | 482 | status_tmp = IF_I_WANT_YOU; |
483 | 483 | ||
484 | if ((batman_if->if_status == status_tmp) || ((batman_if->soft_iface) && | 484 | if (hard_iface->if_status == status_tmp) |
485 | (strncmp(batman_if->soft_iface->name, buff, IFNAMSIZ) == 0))) | 485 | goto out; |
486 | |||
487 | if ((hard_iface->soft_iface) && | ||
488 | (strncmp(hard_iface->soft_iface->name, buff, IFNAMSIZ) == 0)) | ||
486 | goto out; | 489 | goto out; |
487 | 490 | ||
488 | if (status_tmp == IF_NOT_IN_USE) { | 491 | if (status_tmp == IF_NOT_IN_USE) { |
489 | rtnl_lock(); | 492 | rtnl_lock(); |
490 | hardif_disable_interface(batman_if); | 493 | hardif_disable_interface(hard_iface); |
491 | rtnl_unlock(); | 494 | rtnl_unlock(); |
492 | goto out; | 495 | goto out; |
493 | } | 496 | } |
494 | 497 | ||
495 | /* if the interface already is in use */ | 498 | /* if the interface already is in use */ |
496 | if (batman_if->if_status != IF_NOT_IN_USE) { | 499 | if (hard_iface->if_status != IF_NOT_IN_USE) { |
497 | rtnl_lock(); | 500 | rtnl_lock(); |
498 | hardif_disable_interface(batman_if); | 501 | hardif_disable_interface(hard_iface); |
499 | rtnl_unlock(); | 502 | rtnl_unlock(); |
500 | } | 503 | } |
501 | 504 | ||
502 | ret = hardif_enable_interface(batman_if, buff); | 505 | ret = hardif_enable_interface(hard_iface, buff); |
503 | 506 | ||
504 | out: | 507 | out: |
505 | hardif_free_ref(batman_if); | 508 | hardif_free_ref(hard_iface); |
506 | return ret; | 509 | return ret; |
507 | } | 510 | } |
508 | 511 | ||
@@ -510,13 +513,13 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr, | |||
510 | char *buff) | 513 | char *buff) |
511 | { | 514 | { |
512 | struct net_device *net_dev = kobj_to_netdev(kobj); | 515 | struct net_device *net_dev = kobj_to_netdev(kobj); |
513 | struct batman_if *batman_if = get_batman_if_by_netdev(net_dev); | 516 | struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev); |
514 | ssize_t length; | 517 | ssize_t length; |
515 | 518 | ||
516 | if (!batman_if) | 519 | if (!hard_iface) |
517 | return 0; | 520 | return 0; |
518 | 521 | ||
519 | switch (batman_if->if_status) { | 522 | switch (hard_iface->if_status) { |
520 | case IF_TO_BE_REMOVED: | 523 | case IF_TO_BE_REMOVED: |
521 | length = sprintf(buff, "disabling\n"); | 524 | length = sprintf(buff, "disabling\n"); |
522 | break; | 525 | break; |
@@ -535,7 +538,7 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr, | |||
535 | break; | 538 | break; |
536 | } | 539 | } |
537 | 540 | ||
538 | hardif_free_ref(batman_if); | 541 | hardif_free_ref(hard_iface); |
539 | 542 | ||
540 | return length; | 543 | return length; |
541 | } | 544 | } |