Skip to content
Extraits de code Groupes Projets
Valider 8306fbd7 rédigé par François De Keersmaeker's avatar François De Keersmaeker
Parcourir les fichiers

Translator: NFQueue base ID is now optional (default: 0)

parent 677e864c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -12,6 +12,6 @@ NFQ_BASE_ID=0
for DEVICE in "$DEVICES_DIR"/*/; do
# Call translator over device profile
# Arguments $1 & $2 represent the verdict mode
python3 $TRANSLATOR_PATH "$DEVICE"profile.yaml $NFQ_BASE_ID $1 $2
python3 $TRANSLATOR_PATH "$DEVICE"profile.yaml -q $NFQ_BASE_ID $1 $2
((NFQ_BASE_ID=NFQ_BASE_ID+100))
done
......@@ -160,7 +160,7 @@ if __name__ == "__main__":
description = "Translate a device YAML profile to the corresponding pair of NFTables firewall script and NFQueue C source code."
parser = argparse.ArgumentParser(description=description)
parser.add_argument("profile", type=str, help="Path to the device YAML profile")
parser.add_argument("nfq_id_base", type=uint16, help="NFQueue start index for this profile's policies (must be an integer between 0 and 65535)")
parser.add_argument("-q", "--nfqueue", type=uint16, default=0, help="NFQueue start index for this profile's policies (must be an integer between 0 and 65535)")
# Verdict modes
parser.add_argument("-r", "--rate", type=int, help="Rate limit, in packets/second, to apply to matched traffic, instead of a binary verdict. Cannot be used with dropping probability.")
parser.add_argument("-p", "--drop-proba", type=proba, help="Dropping probability to apply to matched traffic, instead of a binary verdict. Cannot be used with rate limiting.")
......@@ -201,7 +201,7 @@ if __name__ == "__main__":
device = profile["device-info"]
# Base nfqueue id, will be incremented at each interaction
nfq_id = args.nfq_id_base
nfq_id = args.nfqueue
# Global accumulators
global_accs = {
......
......@@ -11,6 +11,6 @@ shopt -s nullglob
# Loop over devices
NFQ_BASE_ID=0
for DEVICE in "$DEVICES_DIR"/*/; do
python3 "$TRANSLATOR_PATH" "$DEVICE"profile.yaml $NFQ_BASE_ID
python3 "$TRANSLATOR_PATH" "$DEVICE"profile.yaml -q $NFQ_BASE_ID
((NFQ_BASE_ID=NFQ_BASE_ID+100))
done
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter