-
Notifications
You must be signed in to change notification settings - Fork 17
RDKB-65961 : MACVLAN #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PalakshaOS
wants to merge
1
commit into
rdkcentral:main
Choose a base branch
from
PalakshaOS:macvlan
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -361,7 +361,7 @@ void * Vlan_Disable(void *Arg) | |
|
|
||
| pthread_mutex_lock(&vlan_access_mutex); | ||
| //Set EthLink to False. it will take care UnTagged Created Vlan Interface | ||
| if (Vlan_SetEthLink(pEntry, FALSE, FALSE) == ANSC_STATUS_FAILURE) | ||
| if (pEntry->MacVlanEnable != MACVLAN_DISABLED && Vlan_SetEthLink(pEntry, FALSE, FALSE) == ANSC_STATUS_FAILURE) | ||
| { | ||
| CcspTraceError(("%s-%d: Failed to Enable EthLink\n", __FUNCTION__, __LINE__)); | ||
| } | ||
|
|
@@ -402,6 +402,22 @@ void * Vlan_Disable(void *Arg) | |
| Vlan_DeleteInterface(pEntry); | ||
| #endif | ||
| } | ||
| #if !defined(VLAN_MANAGER_HAL_ENABLED) | ||
| else if(pEntry->VLANId == -1 && pEntry->MacVlanEnable == MACVLAN_DISABLED) | ||
| { | ||
| /* If the VLANID = -1, delete the OVS bridge and remove the interface */ | ||
| if (strcmp(pEntry->BaseInterface, pEntry->Name)) | ||
| { | ||
| if (pEntry->BaseInterface[0] != '\0') | ||
| { | ||
| v_secure_system("brctl delif %s %s", pEntry->Name, pEntry->BaseInterface); | ||
| } | ||
| v_secure_system("ifconfig %s down", pEntry->Name); | ||
| v_secure_system("brctl delbr %s", pEntry->Name); | ||
| } | ||
|
|
||
| } | ||
| #endif | ||
| pEntry->Status = VLAN_IF_DOWN; | ||
| EthLink_SendVirtualIfaceVlanStatus(pEntry->Path, "Down"); | ||
| CcspTraceInfo(("%s - %s:Successfully deleted VLAN interface %s\n", __FUNCTION__, VLAN_MARKER_VLAN_IF_CREATE, pEntry->Name)); | ||
|
|
@@ -590,6 +606,35 @@ static ANSC_STATUS Vlan_CreateTaggedInterface(PDML_VLAN pEntry) | |
| } | ||
| #endif | ||
|
|
||
| #if !defined(VLAN_MANAGER_HAL_ENABLED) | ||
| static ANSC_STATUS Vlan_CreateUnTaggedInterface(PDML_VLAN pEntry) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need separate API? Instead can we make the logic based on valid VLANID? |
||
| { | ||
| ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; | ||
|
|
||
| if (pEntry == NULL) | ||
| { | ||
| CcspTraceError(("%s-%d: Failed to Create UnTagged Vlan Interface\n", __FUNCTION__, __LINE__)); | ||
| return ANSC_STATUS_FAILURE; | ||
| } | ||
|
|
||
| /* If the VLANID = -1, create an OVS bridge and add the interface */ | ||
| if(strcmp(pEntry->BaseInterface, pEntry->Name)) | ||
| { | ||
| v_secure_system("ip link show %s > /dev/null 2>&1 || brctl addbr %s", pEntry->Name, pEntry->Name); | ||
| v_secure_system("brctl addif %s %s 2>/dev/null", pEntry->Name, pEntry->BaseInterface); | ||
| v_secure_system("ifconfig %s up", pEntry->Name); | ||
|
|
||
| if (Vlan_SetMacAddr(pEntry) == ANSC_STATUS_FAILURE) | ||
| { | ||
| CcspTraceError(("%s Failed to Set MacAddress \n", __FUNCTION__)); | ||
| return ANSC_STATUS_FAILURE; | ||
| } | ||
| } | ||
| return returnStatus; | ||
|
PalakshaOS marked this conversation as resolved.
|
||
| } | ||
| #endif | ||
|
|
||
|
|
||
| void * Vlan_Enable(void *Arg) | ||
| { | ||
| ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; | ||
|
|
@@ -607,7 +652,7 @@ void * Vlan_Enable(void *Arg) | |
|
|
||
| pthread_mutex_lock(&vlan_access_mutex); | ||
| //Create Vlan Tagged Interface | ||
| if(pEntry->VLANId > 0) { | ||
| if(pEntry->VLANId > 0 || (pEntry->VLANId == -1 && pEntry->MacVlanEnable == MACVLAN_DISABLED)) { | ||
| if (Vlan_SetEthLink(pEntry, TRUE, TRUE) == ANSC_STATUS_FAILURE) | ||
| { | ||
| CcspTraceError(("%s-%d: Failed to Enable EthLink\n", __FUNCTION__, __LINE__)); | ||
|
|
@@ -617,25 +662,49 @@ void * Vlan_Enable(void *Arg) | |
| { | ||
| CcspTraceError(("[%s][%d]Failed to get vlan interface status \n", __FUNCTION__, __LINE__)); | ||
| } | ||
| #if defined(VLAN_MANAGER_HAL_ENABLED) | ||
| if ( ( status != VLAN_IF_NOTPRESENT ) && ( status != VLAN_IF_ERROR ) ) | ||
| { | ||
| CcspTraceInfo(("%s %s:VLAN interface(%s) already exists, delete it first\n", __FUNCTION__, VLAN_MARKER_VLAN_IF_CREATE, pEntry->Name)); | ||
| #if defined(VLAN_MANAGER_HAL_ENABLED) | ||
| returnStatus = vlan_eth_hal_deleteInterface(pEntry->Name, pEntry->InstanceNumber); | ||
| if (ANSC_STATUS_SUCCESS != returnStatus) | ||
| { | ||
| CcspTraceError(("%s - Failed to delete the existing VLAN interface %s\n", __FUNCTION__, pEntry->Name)); | ||
| } | ||
| CcspTraceInfo(("%s - %s:Successfully deleted VLAN interface %s\n", __FUNCTION__, VLAN_MARKER_VLAN_IF_DELETE, pEntry->Name)); | ||
| else | ||
| #else | ||
| { | ||
| v_secure_system("ip link set %s down", pEntry->Name); | ||
| v_secure_system("ip link delete %s",pEntry->Name); | ||
| } | ||
| #endif | ||
| { | ||
| CcspTraceInfo(("%s - %s:Successfully deleted VLAN interface %s\n", __FUNCTION__, VLAN_MARKER_VLAN_IF_DELETE, pEntry->Name)); | ||
| } | ||
| } | ||
|
|
||
| #if !defined(VLAN_MANAGER_HAL_ENABLED) | ||
| if(pEntry->VLANId > 0) | ||
| { | ||
| #endif | ||
| returnStatus = Vlan_CreateTaggedInterface(pEntry); | ||
| if (ANSC_STATUS_SUCCESS != returnStatus) | ||
| returnStatus = Vlan_CreateTaggedInterface(pEntry); | ||
| if (ANSC_STATUS_SUCCESS != returnStatus) | ||
| { | ||
| pEntry->Status = VLAN_IF_ERROR; | ||
| CcspTraceError(("[%s][%d]Failed to create VLAN Tagged interface \n", __FUNCTION__, __LINE__)); | ||
| } | ||
| #if !defined(VLAN_MANAGER_HAL_ENABLED) | ||
| } | ||
| else | ||
| { | ||
| pEntry->Status = VLAN_IF_ERROR; | ||
| CcspTraceError(("[%s][%d]Failed to create VLAN Tagged interface \n", __FUNCTION__, __LINE__)); | ||
| returnStatus = Vlan_CreateUnTaggedInterface(pEntry); | ||
| if (ANSC_STATUS_SUCCESS != returnStatus) | ||
| { | ||
| pEntry->Status = VLAN_IF_ERROR; | ||
| CcspTraceError(("[%s][%d]Failed to create VLAN UnTagged interface \n", __FUNCTION__, __LINE__)); | ||
| } | ||
| } | ||
|
|
||
| #endif | ||
| //Get status of VLAN link | ||
| while(iIterator < 10) | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.