Skip to content

Commit 1c7c4e1

Browse files
committed
router_config: fix signal compatibility check logic
Fix 'any bit matches' logic to require all requested signals and ensure multi-signal routes only connect to outputs supporting all signals Signed-off-by: Eduardo Silva <[email protected]>
1 parent 6c63f07 commit 1c7c4e1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/flb_router_config.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,23 +1132,23 @@ static int output_supports_signals(struct flb_output_instance *out, uint32_t sig
11321132
return FLB_FALSE;
11331133
}
11341134

1135-
if (signals == 0 || signals == FLB_ROUTER_SIGNAL_ANY) {
1135+
/* Handle ANY signal - if ANY is present in the bitmask, allow all signals */
1136+
if (signals == 0 || (signals & FLB_ROUTER_SIGNAL_ANY)) {
11361137
return FLB_TRUE;
11371138
}
11381139

1139-
if ((signals & FLB_ROUTER_SIGNAL_LOGS) && (out->event_type & FLB_OUTPUT_LOGS)) {
1140-
return FLB_TRUE;
1140+
/* Require support for all requested signal bits */
1141+
if ((signals & FLB_ROUTER_SIGNAL_LOGS) && !(out->event_type & FLB_OUTPUT_LOGS)) {
1142+
return FLB_FALSE;
11411143
}
1142-
1143-
if ((signals & FLB_ROUTER_SIGNAL_METRICS) && (out->event_type & FLB_OUTPUT_METRICS)) {
1144-
return FLB_TRUE;
1144+
if ((signals & FLB_ROUTER_SIGNAL_METRICS) && !(out->event_type & FLB_OUTPUT_METRICS)) {
1145+
return FLB_FALSE;
11451146
}
1146-
1147-
if ((signals & FLB_ROUTER_SIGNAL_TRACES) && (out->event_type & FLB_OUTPUT_TRACES)) {
1148-
return FLB_TRUE;
1147+
if ((signals & FLB_ROUTER_SIGNAL_TRACES) && !(out->event_type & FLB_OUTPUT_TRACES)) {
1148+
return FLB_FALSE;
11491149
}
11501150

1151-
return FLB_FALSE;
1151+
return FLB_TRUE;
11521152
}
11531153

11541154
int flb_router_apply_config(struct flb_config *config)

0 commit comments

Comments
 (0)