]> git.ipfire.org Git - ipfire.org.git/commitdiff
fireinfo: Store ASN
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 7 Jan 2024 17:47:19 +0000 (17:47 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 7 Jan 2024 17:47:19 +0000 (17:47 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/fireinfo.py
src/web/fireinfo.py

index 260572ae3a592ef4eb981d8a72d753f43a794846..635cd08a80b7bd654ada908c6acffe9dfe8e863c 100644 (file)
@@ -808,7 +808,7 @@ class Fireinfo(Object):
 
        # Handle profile
 
-       def handle_profile(self, profile_id, blob, country_code=None, when=None):
+       def handle_profile(self, profile_id, blob, country_code=None, asn=None, when=None):
                private_id = blob.get("private_id", None)
                assert private_id
 
@@ -863,7 +863,8 @@ class Fireinfo(Object):
                                private_id,
                                version,
                                blob,
-                               country_code
+                               country_code,
+                               asn
                        )
                        VALUES
                        (
@@ -871,9 +872,10 @@ class Fireinfo(Object):
                                %s,
                                %s,
                                %s,
+                               %s,
                                %s
                        )
-                       """, profile_id, private_id, version, json.dumps(profile), country_code,
+                       """, profile_id, private_id, version, json.dumps(profile), country_code, asn,
                )
 
        def _validate(self, profile_id, version, blob):
index fb33a92c1d576330ff8d302856fc2feee3a764d9..78fe9e6b27d7efcf2163c363eb8f2f07f251c86a 100644 (file)
@@ -37,7 +37,8 @@ class ProfileSendHandler(BaseHandler):
                with self.db.transaction():
                        try:
                                self.fireinfo.handle_profile(public_id, profile_blob,
-                                       country_code=self.current_country_code)
+                                       country_code=self.current_country_code,
+                                       asn=self.current_address.asn if self.current_address else None)
 
                        except ValueError as e:
                                raise tornado.web.HTTPError(400, "Could not process profile: %s" % e)