-
Notifications
You must be signed in to change notification settings - Fork 44
RDKBWIFI-202: Implementation of Traffic Separation #263
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
siddharth-nair-dtdl
wants to merge
1
commit into
rdkcentral:develop
Choose a base branch
from
siddharth-nair-dtdl:RDKBWIFI-202
base: develop
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| /* | ||
| * If not stated otherwise in this file or this component's Licenses.txt file the | ||
| * following copyright and licenses apply: | ||
| * | ||
| * Copyright 2015 RDK Management | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| /********************************************************************** | ||
| Copyright [2014] [Cisco Systems, Inc.] | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| **********************************************************************/ | ||
|
|
||
| #include <stdio.h> | ||
| #include "srvmgr.h" | ||
|
|
||
| const char* SERVICE_NAME = "vlan_ts"; | ||
| const char* SERVICE_DEFAULT_HANDLER = "/etc/utopia/service.d/service_vlan_ts.sh"; | ||
| const char* SERVICE_CUSTOM_EVENTS[] = { NULL }; | ||
| /*const char* SERVICE_CUSTOM_EVENTS[] = { | ||
| "lan-status|/etc/utopia/service.d/service_xhs.sh", | ||
| "multinet_2-status|/etc/utopia/service.d/service_xhs.sh", | ||
| "ipv4_5-status|/etc/utopia/service.d/service_xhs.sh", | ||
| NULL | ||
| }; */ | ||
|
|
||
| void srv_register(void) { | ||
| printf("%s %d : START \n", __func__,__LINE__); | ||
| sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS); | ||
| } | ||
|
|
||
| void srv_unregister(void) { | ||
| printf("%s %d : START \n", __func__,__LINE__); | ||
| sm_unregister(SERVICE_NAME); | ||
| } | ||
|
|
||
| int main(int argc, char **argv) | ||
| { | ||
| cmd_type_t choice = parse_cmd_line(argc, argv); | ||
| printf("%s %d : START \n", __func__,__LINE__); | ||
| switch(choice) { | ||
| case(nochoice): | ||
| case(start): | ||
| printf("%s %d : case start \n", __func__,__LINE__); | ||
| srv_register(); | ||
| break; | ||
| case(stop): | ||
| printf("%s %d : case stop \n", __func__,__LINE__); | ||
| srv_unregister(); | ||
| break; | ||
| case(restart): | ||
| printf("%s %d : case restart \n", __func__,__LINE__); | ||
| srv_unregister(); | ||
| srv_register(); | ||
| break; | ||
| default: | ||
| printf("%s called with invalid parameter (%s)\n", argv[0], 1==argc ? "" : argv[1]); | ||
| } | ||
| return(0); | ||
| } | ||
|
|
||
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 |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| SERVICE_NAME="vlan_ts" | ||
| source /etc/utopia/service.d/ulog_functions.sh | ||
| source /etc/utopia/service.d/ut_plat.sh | ||
|
|
||
|
|
||
| SELF_NAME="`basename "$0"`" | ||
|
|
||
| service_start() { | ||
| vlan_pvt=`syscfg get vlan_id_pvt` | ||
| vlan_mesh=`syscfg get vlan_id_mesh` | ||
| vlan_iot=`syscfg get vlan_id_iot` | ||
|
|
||
| echo "service_start : START" >> /tmp/abc.txt | ||
|
|
||
| ip link set brlan0 type bridge vlan_filtering 1 | ||
| bridge vlan add dev wifi0 vid $vlan_pvt pvid untagged | ||
| bridge vlan add dev wifi0.1 vid $vlan_mesh pvid untagged | ||
| bridge vlan add dev wifi0.2 vid $vlan_iot pvid untagged | ||
| bridge vlan add dev wifi1 vid $vlan_pvt pvid untagged | ||
| bridge vlan add dev wifi1.1 vid $vlan_mesh pvid untagged | ||
| bridge vlan add dev wifi1.2 vid $vlan_iot pvid untagged | ||
| bridge vlan add dev wifi2 vid $vlan_pvt pvid untagged | ||
| bridge vlan add dev wifi2.1 vid $vlan_mesh pvid untagged | ||
| bridge vlan add dev wifi2.2 vid $vlan_iot pvid untagged | ||
| bridge vlan add dev mld0 vid $vlan_pvt pvid untagged | ||
|
|
||
| ip link add link brlan0 name brlan0.$vlan_pvt type vlan id $vlan_pvt | ||
| ip link add link brlan0 name brlan0.$vlan_mesh type vlan id $vlan_mesh | ||
| ip link add link brlan0 name brlan0.$vlan_iot type vlan id $vlan_iot | ||
|
|
||
| bridge vlan add dev brlan0 vid $vlan_pvt self | ||
| bridge vlan add dev brlan0 vid $vlan_mesh self | ||
| bridge vlan add dev brlan0 vid $vlan_iot self | ||
|
|
||
| ifconfig brlan0.$vlan_pvt 192.168.13.1 netmask 255.255.255.0 up | ||
| ifconfig brlan0.$vlan_mesh 192.168.14.1 netmask 255.255.255.0 up | ||
| ifconfig brlan0.$vlan_iot 192.168.15.1 netmask 255.255.255.0 up | ||
|
|
||
| iptables -I FORWARD -i brlan0.$vlan_pvt -o brlan0.$vlan_mesh -j DROP | ||
| iptables -I FORWARD -i brlan0.$vlan_mesh -o brlan0.$vlan_pvt -j DROP | ||
|
|
||
| iptables -I FORWARD -i brlan0.$vlan_mesh -o brlan0.$vlan_iot -j DROP | ||
| iptables -I FORWARD -i brlan0.$vlan_iot -o brlan0.$vlan_mesh -j DROP | ||
|
|
||
| iptables -I FORWARD -i brlan0.$vlan_pvt -o brlan0.$vlan_iot -j DROP | ||
| iptables -I FORWARD -i brlan0.$vlan_iot -o brlan0.$vlan_pvt -j DROP | ||
|
|
||
| iptables -I INPUT -i brlan0.$vlan_pvt -p udp --dport 67:68 -j ACCEPT | ||
| iptables -I INPUT -i brlan0.$vlan_pvt -p udp --sport 67:68 -j ACCEPT | ||
| iptables -I INPUT -i brlan0.$vlan_mesh -p udp --dport 67:68 -j ACCEPT | ||
| iptables -I INPUT -i brlan0.$vlan_mesh -p udp --sport 67:68 -j ACCEPT | ||
| iptables -I INPUT -i brlan0.$vlan_iot -p udp --dport 67:68 -j ACCEPT | ||
| iptables -I INPUT -i brlan0.$vlan_iot -p udp --sport 67:68 -j ACCEPT | ||
|
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. Indentation to be checked above |
||
|
|
||
| echo "interface=brlan0.$vlan_pvt" >> /var/dnsmasq.conf | ||
| echo "dhcp-range=192.168.13.2,192.168.13.253,255.255.255.0,7d" >> /var/dnsmasq.conf | ||
| echo "interface=brlan0.$vlan_mesh" >> /var/dnsmasq.conf | ||
| echo "dhcp-range=192.168.14.2,192.168.14.253,255.255.255.0,7d" >> /var/dnsmasq.conf | ||
| echo "interface=brlan0.$vlan_iot" >> /var/dnsmasq.conf | ||
| echo "dhcp-range=192.168.15.2,192.168.15.253,255.255.255.0,7d" >> /var/dnsmasq.conf | ||
|
|
||
| killall dnsmasq | ||
| dnsmasq -P 4096 -C /var/dnsmasq.conf --dhcp-authoritative | ||
| } | ||
|
|
||
| service_stop () { | ||
| ip link set brlan0 type bridge vlan_filtering 1 | ||
|
|
||
| vlan_pvt=`syscfg get vlan_id_pvt` | ||
| vlan_mesh=`syscfg get vlan_id_mesh` | ||
| vlan_iot=`syscfg get vlan_id_iot` | ||
|
|
||
| echo "service_stop : START " >> /tmp/abc.txt | ||
|
|
||
| bridge vlan del vid $vlan_pvt dev wifi0 | ||
| bridge vlan del vid $vlan_mesh dev wifi0.1 | ||
| bridge vlan del vid $vlan_iot dev wifi0.2 | ||
| bridge vlan del vid $vlan_pvt dev wifi1 | ||
| bridge vlan del vid $vlan_mesh dev wifi1.1 | ||
| bridge vlan del vid $vlan_iot dev wifi1.2 | ||
| bridge vlan del vid $vlan_pvt dev wifi2 | ||
| bridge vlan del vid $vlan_mesh dev wifi2.1 | ||
| bridge vlan del vid $vlan_iot dev wifi2.2 | ||
| bridge vlan del vid $vlan_pvt dev mld0 | ||
|
|
||
| bridge vlan del dev brlan0 vid $vlan_pvt self | ||
| bridge vlan del dev brlan0 vid $vlan_mesh self | ||
| bridge vlan del dev brlan0 vid $vlan_iot self | ||
|
|
||
| ip link del link brlan0 name brlan0.$vlan_pvt type vlan id $vlan_pvt | ||
| ip link del link brlan0 name brlan0.$vlan_mesh type vlan id $vlan_mesh | ||
| ip link del link brlan0 name brlan0.$vlan_iot type vlan id $vlan_iot | ||
|
|
||
| bridge vlan del vid 1 dev wifi0 | ||
| bridge vlan del vid 1 dev wifi0.1 | ||
| bridge vlan del vid 1 dev wifi02 | ||
|
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. there seems to be a typo as wifi02, there is already wifi0.2 in the below line |
||
| bridge vlan del vid 1 dev wifi0.2 | ||
| bridge vlan del vid 1 dev wifi1.2 | ||
| bridge vlan del vid 1 dev wifi1.1 | ||
| bridge vlan del vid 1 dev wifi1 | ||
| bridge vlan del vid 1 dev wifi2 | ||
| bridge vlan del vid 1 dev wifi2.1 | ||
| bridge vlan del vid 1 dev wifi2.2 | ||
| bridge vlan del vid 1 dev mld0 | ||
|
|
||
| sed -i '/brlan0./d' /var/dnsmasq.conf | ||
| sed -i '/brlan0./d' /var/dnsmasq.conf | ||
| sed -i '/brlan0./d' /var/dnsmasq.conf | ||
|
|
||
| sed -i '/192.168.13.2/d' /var/dnsmasq.conf | ||
| sed -i '/192.168.14.2/d' /var/dnsmasq.conf | ||
| sed -i '/192.168.15.2/d' /var/dnsmasq.conf | ||
|
|
||
| killall dnsmasq | ||
| dnsmasq -P 4096 -C /var/dnsmasq.conf --dhcp-authoritative | ||
|
|
||
| iptables -D FORWARD -i brlan0.$vlan_pvt -o brlan0.$vlan_mesh -j DROP | ||
| iptables -D FORWARD -i brlan0.$vlan_mesh -o brlan0.$vlan_pvt -j DROP | ||
|
|
||
| iptables -D FORWARD -i brlan0.$vlan_mesh -o brlan0.$vlan_iot -j DROP | ||
| iptables -D FORWARD -i brlan0.$vlan_iot -o brlan0.$vlan_mesh -j DROP | ||
|
|
||
| iptables -D FORWARD -i brlan0.$vlan_pvt -o brlan0.$vlan_iot -j DROP | ||
| iptables -D FORWARD -i brlan0.$vlan_iot -o brlan0.$vlan_pvt -j DROP | ||
|
|
||
| iptables -D INPUT -i brlan0.$vlan_pvt -p udp --dport 67:68 -j ACCEPT | ||
| iptables -D INPUT -i brlan0.$vlan_pvt -p udp --sport 67:68 -j ACCEPT | ||
| iptables -D INPUT -i brlan0.$vlan_mesh -p udp --dport 67:68 -j ACCEPT | ||
| iptables -D INPUT -i brlan0.$vlan_mesh -p udp --sport 67:68 -j ACCEPT | ||
| iptables -D INPUT -i brlan0.$vlan_iot -p udp --dport 67:68 -j ACCEPT | ||
| iptables -D INPUT -i brlan0.$vlan_iot -p udp --sport 67:68 -j ACCEPT | ||
| } | ||
|
|
||
|
|
||
| service_init() { | ||
| echo "service_init : START " >> /tmp/abc.txt | ||
| } | ||
|
|
||
| #--------------------------------------------------------------- | ||
|
|
||
| service_init | ||
|
|
||
| case "$1" in | ||
| start) | ||
| service_start | ||
| ;; | ||
| stop) | ||
| service_stop | ||
| ;; | ||
| restart) | ||
| service_stop | ||
| service_start | ||
| ;; | ||
| *) | ||
| echo "Usage: $SERVICE_NAME [ start | stop | restart]" > /dev/console | ||
| exit 3 | ||
| ;; | ||
| esac | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation to be corrected