Przeglądaj źródła

[rndis] Register netdev with MAC filled

register_netdev expects ->hw_addr and ->ll_addr to be already filled,
so move it towards the end of register_rndis, after the respective
fields have been successfully queried from the underlying device.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Roman Kagan 6 lat temu
rodzic
commit
16d7495308
1 zmienionych plików z 9 dodań i 9 usunięć
  1. 9
    9
      src/net/rndis.c

+ 9
- 9
src/net/rndis.c Wyświetl plik

@@ -973,13 +973,6 @@ int register_rndis ( struct rndis_device *rndis ) {
973 973
 	/* Assign device name (for debugging) */
974 974
 	rndis->name = netdev->dev->name;
975 975
 
976
-	/* Register network device */
977
-	if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
978
-		DBGC ( rndis, "RNDIS %s could not register: %s\n",
979
-		       rndis->name, strerror ( rc ) );
980
-		goto err_register;
981
-	}
982
-
983 976
 	/* Open RNDIS device to read MAC addresses */
984 977
 	if ( ( rc = rndis->op->open ( rndis ) ) != 0 ) {
985 978
 		DBGC ( rndis, "RNDIS %s could not open: %s\n",
@@ -1012,8 +1005,17 @@ int register_rndis ( struct rndis_device *rndis ) {
1012 1005
 	/* Close RNDIS device */
1013 1006
 	rndis->op->close ( rndis );
1014 1007
 
1008
+	/* Register network device */
1009
+	if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
1010
+		DBGC ( rndis, "RNDIS %s could not register: %s\n",
1011
+		       rndis->name, strerror ( rc ) );
1012
+		goto err_register;
1013
+	}
1014
+
1015 1015
 	return 0;
1016 1016
 
1017
+	unregister_netdev ( netdev );
1018
+ err_register:
1017 1019
  err_query_link:
1018 1020
  err_query_current:
1019 1021
  err_query_permanent:
@@ -1021,8 +1023,6 @@ int register_rndis ( struct rndis_device *rndis ) {
1021 1023
  err_initialise:
1022 1024
 	rndis->op->close ( rndis );
1023 1025
  err_open:
1024
-	unregister_netdev ( netdev );
1025
- err_register:
1026 1026
 	return rc;
1027 1027
 }
1028 1028
 

Ładowanie…
Anuluj
Zapisz