add fake promisc setup scripts for tera mac-flipping.

This commit is contained in:
fumingwei
2020-12-03 16:53:34 +06:00
parent cf2e80c4d7
commit 75b1e7db47
4 changed files with 24 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
[Service]
ExecStartPre=/bin/bash tera_fake_promisc_setup.sh

View File

@@ -0,0 +1,4 @@
set -ex
dp_adapter_ether_addr=$(ifconfig ens1f2 | grep ether | awk '{print $2}')
bpf_rule="ether dst $dp_adapter_ether_addr or ether dst 02:42:c0:a8:fd:03 or ether dst 02:42:c0:a8:fd:83 or ether dst 02:42:c0:a8:fd:82"
sed -i "/BSD_packet_filter=/s/=.*/=\"$bpf_rule\"/" etc/sapp.toml

View File

@@ -70,6 +70,7 @@
dest: /home/mesasoft/sapp_run/etc/vlan_flipping_map.conf dest: /home/mesasoft/sapp_run/etc/vlan_flipping_map.conf
when: tsg_access_type == 2 when: tsg_access_type == 2
- name: "Template sapp.service destination server" - name: "Template sapp.service destination server"
template: template:
src: "{{ role_path }}/templates/sapp.service.j2" src: "{{ role_path }}/templates/sapp.service.j2"
@@ -82,6 +83,20 @@
dest: /etc/systemd/system/sapp.service.d/ dest: /etc/systemd/system/sapp.service.d/
mode: 0644 mode: 0644
- name: "copy fake promisc tools for tera mode - service file"
copy:
src: "{{ role_path }}/files/tera_fake_promisc_setup.conf"
dest: /etc/systemd/system/sapp.service.d/
mode: 0644
when: tsg_access_type == 2
- name: "copy fake promisc tools for tera mode - scripts"
copy:
src: "{{ role_path }}/files/tera_fake_promisc_setup.sh"
dest: /home/mesasoft/sapp_run/tera_fake_promisc_setup.sh
mode: 0755
when: tsg_access_type == 2
- name: "enable sapp" - name: "enable sapp"
systemd: systemd:
name: sapp name: sapp

View File

@@ -40,6 +40,8 @@ dictator_enable=0
asymmetric_addr_layer_cfg_file="etc/asymmetric_addr_layer.conf" asymmetric_addr_layer_cfg_file="etc/asymmetric_addr_layer.conf"
prune_inject_layer_cfg_file="etc/prune_inject_layer.conf" prune_inject_layer_cfg_file="etc/prune_inject_layer.conf"
[packet_io.feature]
{% if tsg_access_type == 4 %} {% if tsg_access_type == 4 %}
### note, used to represent inbound or outbound direction value, ### note, used to represent inbound or outbound direction value,
### because it comes from Third party device, so it needs to be specified manually, ### because it comes from Third party device, so it needs to be specified manually,