diff --git a/profile_translator_blocklist/templates/CMakeLists.txt.j2 b/profile_translator_blocklist/templates/CMakeLists.txt.j2 index bc15605b24c2f177920a16013193de564558c96e..c7db734ee908c6dfb1be00f7483549680f4bbd77 100644 --- a/profile_translator_blocklist/templates/CMakeLists.txt.j2 +++ b/profile_translator_blocklist/templates/CMakeLists.txt.j2 @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.20) set(EXECUTABLE_OUTPUT_PATH ${BIN_DIR}) # Nfqueue C file for device {{device}} -{% set nfqueue_name = nfqueue.name.replace(':', '_').replace('#', '_').replace('.', '_').replace('/', '_').replace('*', '_').replace('?', '_').replace('=', '_') %} +{% set nfqueue_name = nfqueue_name.replace(':', '_').replace('#', '_').replace('.', '_').replace('/', '_').replace('*', '_').replace('?', '_').replace('=', '_') %} add_executable({{nfqueue_name}} nfqueues.c) target_link_libraries({{nfqueue_name}} pthread) IF( OPENWRT_CROSSCOMPILING ) diff --git a/profile_translator_blocklist/templates/main.c.j2 b/profile_translator_blocklist/templates/main.c.j2 index 1ce55115a41961773a3efdf2859cd9ff8374f5a3..6a732a0fe2e0684c5bfd2601bdf5ffded29dfc86 100644 --- a/profile_translator_blocklist/templates/main.c.j2 +++ b/profile_translator_blocklist/templates/main.c.j2 @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) { // Initialize variables int ret; {% if use_dns %} - char *dns_server_ip = "8.8.8.8"; // Default DNS server: Google Quad8 + char *dns_server_ip = "192.168.1.1"; // Default DNS server: LAN gateway {% endif %} // Setup SIGINT handler diff --git a/profile_translator_blocklist/translator.py b/profile_translator_blocklist/translator.py index 5499764532f5039cc9552930ab4132f90d36a55f..28880b965fc0c930dc88bc4e212a85dc5386e1bf 100644 --- a/profile_translator_blocklist/translator.py +++ b/profile_translator_blocklist/translator.py @@ -5,7 +5,7 @@ of NFTables firewall script and NFQueue C source code. ## Imports # Libraries -from typing import Iterator +from typing import Iterable import os import importlib import yaml @@ -301,7 +301,7 @@ def translate_policy( def translate_policies( device: dict, - policies: Iterator[dict], + policies: Iterable[dict], nfqueue_name: str = None, nfqueue_id: int = 0, output_dir: str = os.getcwd(), @@ -316,7 +316,7 @@ def translate_policies( Args: device (dict): Device metadata - policies (Iterator[dict]): iterator over policies + policies (Iterable[dict]): iterable containing the policies to translate nfqueue_id (int): NFQueue start index for this profile's policies (must be an integer between 0 and 65535) output_dir (str): Output directory for the generated files rate (int): Rate limit, in packets/second, to apply to matched traffic, instead of a binary verdict