]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Nest: Add EC_SET_WALK()
authorIgor Putovny <igor.putovny@nic.cz>
Mon, 7 Jul 2025 14:07:52 +0000 (16:07 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Fri, 18 Jul 2025 00:08:24 +0000 (02:08 +0200)
nest/attrs.h

index 0475afa72c8f2f7239e760f5a395c8c05c64acb3..2eb6adf505188d511c163456caaf066a3b3384e5 100644 (file)
@@ -185,6 +185,16 @@ static inline u64 ec_ip4(enum ec_subtype kind, u64 key, u64 val)
 static inline u64 ec_generic(u64 key, u64 val)
 { return (key << 32) | val; }
 
+#define EC_SET_WALK(ec,ad)                                     \
+  do {                                                         \
+    const u32 *_set = int_set_get_data(ad);                    \
+    const int _len  = int_set_get_size(ad);                    \
+    u64 ec = 0;                                                        \
+    for (int _i = 0; (_i < _len) && (ec = ec_get(_set, _i), 1); _i += 2)
+
+#define EC_SET_WALK_END } while (0)
+
+
 /* Large community value */
 typedef struct lcomm {
   u32 asn;