aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts/revert_tap_wireless_int.sh
diff options
context:
space:
mode:
authorsuchinton2001 <suchinton.2001@gmail.com>2023-07-22 18:39:14 +0530
committersuchinton2001 <suchinton.2001@gmail.com>2023-09-07 18:31:07 +0530
commitdb9f586a19fed7bcd04be3596fc30dc53f61b1db (patch)
tree476d86c085137779f47ee6b409e3a8aaac68991d /Scripts/revert_tap_wireless_int.sh
parentf9b00b992d88edc0e9c31de809a1a981139c4fde (diff)
Upload progress on AGL demo control panel in one batch
AGL Demo Control Panel is a PyQt5 application used to simulate CAN bus signals using Kuksa.val v1: Initial commit v2: Remove unused assets v3: Add Opensans fonts, remove un-used styles and add Lisences as attributions v4: - Remove Opensans fonts, default to Dejavu fonts - Replace feather icons with carbon icons. - Reusing AGL demo app assests for HVAC and Steering wheel inputs. v5: Remove assets/Images/Lisences.md attribution file Signed-off-by: suchinton2001 <suchinton.2001@gmail.com> Change-Id: I1529495deff6fc27eacb92f7a29c4f71f8c8d5d9
Diffstat (limited to 'Scripts/revert_tap_wireless_int.sh')
-rw-r--r--Scripts/revert_tap_wireless_int.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/Scripts/revert_tap_wireless_int.sh b/Scripts/revert_tap_wireless_int.sh
new file mode 100644
index 0000000..b23cf3a
--- /dev/null
+++ b/Scripts/revert_tap_wireless_int.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+BRIDGE=br0
+NETWORK=10.10.10.0
+NETMASK=255.255.255.0
+GATEWAY=10.10.10.1
+DHCPRANGE=10.10.10.100,10.10.10.254
+
+# Delete the bridge interface
+ip link delete dev $BRIDGE type bridge
+
+# Disable IP forwarding
+sysctl -w net.ipv4.ip_forward=0 > /dev/null 2>&1
+
+# Flush existing iptables rules and set default policies to ACCEPT
+iptables --flush
+iptables -t nat -F
+iptables -X
+iptables -Z
+iptables -P OUTPUT ACCEPT
+iptables -P INPUT ACCEPT
+iptables -P FORWARD ACCEPT
+
+# Allow DHCP and DNS traffic on the network interface
+iptables -A INPUT -i $BRIDGE -p tcp -m tcp --dport 67 -j ACCEPT
+iptables -A INPUT -i $BRIDGE -p udp -m udp --dport 67 -j ACCEPT
+iptables -A INPUT -i $BRIDGE -p tcp -m tcp --dport 53 -j ACCEPT
+iptables -A INPUT -i $BRIDGE -p udp -m udp --dport 53 -j ACCEPT
+
+# Allow forwarding of packets between the network and the bridge
+iptables -A FORWARD -s $NETWORK/$NETMASK -i $BRIDGE -j ACCEPT
+iptables -A FORWARD -d $NETWORK/$NETMASK -o $BRIDGE -m state --state RELATED,ESTABLISHED -j ACCEPT
+
+# Delete the network address translation (NAT) rules
+iptables -t nat -D POSTROUTING -s $NETWORK/$NETMASK -d $NETWORK/$NETMASK -j ACCEPT
+iptables -t nat -D POSTROUTING -s $NETWORK/$NETMASK -j MASQUERADE
+
+# Delete the dnsmasq process
+pid_file="/var/run/qemu-dnsmasq-$BRIDGE.pid"
+if [ -f "$pid_file" ]; then
+ kill $(cat "$pid_file")
+ rm "$pid_file"
+fi
+
+# Remove the wireless interface from the forwarding rules
+iptables -D FORWARD -i $BRIDGE -o $WIRELESS -j ACCEPT
+iptables -t nat -D POSTROUTING -o $WIRELESS -j MASQUERADE
+
+# Allow known traffic from the wireless interface to return to the network interface
+iptables -D FORWARD -i $WIRELESS -o $BRIDGE -m state --state RELATED,ESTABLISHED -j ACCEPT
+
+echo "Reverted back to default configuration."
+