librmnetctl: Add support to create device name as specified by user

rmnet_data assigns device name by the order they are created.
This causes problems which multiple processes are trying to
create devices and leads to random device names.

Assign device name as specified by user.

CRs-Fixed: 2018794
Change-Id: Ie0630611d658418b067df796321f4c3f565b9661
This commit is contained in:
Subash Abhinov Kasiviswanathan
2017-02-23 17:58:09 -07:00
committed by Gerrit - the friendly Code Review server
parent 7f901325a7
commit dba447c1ee
3 changed files with 77 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
R M N E T C L I . C
Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
Copyright (c) 2013-2015, 2017 The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -187,6 +187,13 @@ static void rmnet_api_usage(void)
printf(_5TABS" must be less than");
printf(_5TABS" 15 chars. Returns");
printf(_5TABS" the status code\n\n");
printf("rmnetcli newvndname <dev_id> <name_prefix> Creates");
printf(_5TABS" virtual network device node.");
printf(_5TABS" dev_id is an int");
printf(_5TABS" less than 32. Name");
printf(_5TABS" must be less than");
printf(_5TABS" 15 chars. Returns");
printf(_5TABS" the status code\n\n");
printf("rmnetcli getvndname <dev_id> Get name of");
printf(_5TABS" network device node from id\n\n");
printf("rmnetcli freevnd <dev_id> Removes virtual");
@@ -311,6 +318,11 @@ static int rmnet_api_call(int argc, char *argv[])
_RMNETCLI_CHECKNULL(argv[2]);
return_code = rmnet_new_vnd_prefix(handle,
_STRTOUI32(argv[1]), &error_number, RMNETCTL_NEW_VND, argv[2]);
} else if (!strcmp(*argv, "newvndname")) {
_RMNETCLI_CHECKNULL(argv[1]);
_RMNETCLI_CHECKNULL(argv[2]);
return_code = rmnet_new_vnd_name(handle,
_STRTOUI32(argv[1]), &error_number, argv[2]);
} else if (!strcmp(*argv, "newvnd")) {
_RMNETCLI_CHECKNULL(argv[1]);
return_code = rmnet_new_vnd(handle,