]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Add EC_SET_WALK
authorIgor Putovny <igor.putovny@nic.cz>
Mon, 7 Jul 2025 14:07:52 +0000 (16:07 +0200)
committerIgor Putovny <igor.putovny@nic.cz>
Mon, 7 Jul 2025 14:07:52 +0000 (16:07 +0200)
nest/attrs.h

index 0475afa72c8f2f7239e760f5a395c8c05c64acb3..9521a6505b85dd2fa6cadd56022fb6d5a1f91561 100644 (file)
@@ -185,6 +185,15 @@ 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_BEGIN(ad)                                  \
+  do {                                                         \
+    const u32 *_z = int_set_get_data(ad);                      \
+    const int _len = ec_set_get_size(ad);                      \
+    u64 ec = 0;                                                        \
+    for (int _i = 0; _i < _len; ec = ec_get(_z, _i), _i += 2)
+
+#define EC_SET_WALK_END } while (0)
+
 /* Large community value */
 typedef struct lcomm {
   u32 asn;