upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/tollgate_core/src/tollgate_core_firewall.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/components/tollgate_core/src/tollgate_core_firewall.c b/components/tollgate_core/src/tollgate_core_firewall.c
index 4f12923..5dbdc7a 100644
--- a/components/tollgate_core/src/tollgate_core_firewall.c
+++ b/components/tollgate_core/src/tollgate_core_firewall.c
@@ -18,7 +18,6 @@
18static const char *TAG = "tg_core_fw"; 18static const char *TAG = "tg_core_fw";
19static esp_ip4_addr_t s_ap_ip; 19static esp_ip4_addr_t s_ap_ip;
20static uint16_t s_mining_port = 3333; 20static uint16_t s_mining_port = 3333;
21static bool s_sandbox_mint_access = false;
22 21
23typedef struct { 22typedef struct {
24 uint32_t ip; 23 uint32_t ip;
@@ -81,7 +80,7 @@ void tollgate_core_fw_set_sandbox_ports(uint16_t mining_port)
81 80
82void tollgate_core_fw_set_sandbox_mint_access(bool enabled) 81void tollgate_core_fw_set_sandbox_mint_access(bool enabled)
83{ 82{
84 s_sandbox_mint_access = enabled; 83 (void)enabled;
85} 84}
86 85
87static bool is_sandbox_allowed(struct pbuf *p) 86static bool is_sandbox_allowed(struct pbuf *p)
@@ -98,17 +97,16 @@ static bool is_sandbox_allowed(struct pbuf *p)
98 struct tcp_hdr *tcphdr = (struct tcp_hdr *)((uint8_t *)p->payload + IP_HLEN); 97 struct tcp_hdr *tcphdr = (struct tcp_hdr *)((uint8_t *)p->payload + IP_HLEN);
99 dst_port = lwip_ntohs(tcphdr->dest); 98 dst_port = lwip_ntohs(tcphdr->dest);
100 } 99 }
101 if (dst_port == 80 || dst_port == 2121 || dst_port == s_mining_port) { 100 if (dst_port == 80 || dst_port == 2121 || dst_port == 4869 || dst_port == s_mining_port) {
102 return true; 101 return true;
103 } 102 }
104 } 103 }
105 if (iphdr->_proto == IP_PROTO_UDP) { 104 if (iphdr->_proto == IP_PROTO_UDP) {
106 return true; 105 return true;
107 } 106 }
108 } 107 if (iphdr->_proto == 1) {
109 108 return true;
110 if (s_sandbox_mint_access && iphdr->_proto == IP_PROTO_TCP) { 109 }
111 return true;
112 } 110 }
113 111
114 return false; 112 return false;