Module: kamailio
Branch: master
Commit: 40c9f5d157ca5f04b5f09369c72d6dbcb892e1d6
URL: 
https://github.com/kamailio/kamailio/commit/40c9f5d157ca5f04b5f09369c72d6dbcb892e1d6

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-01-15T13:48:08+01:00

core: flag to skip applied data lumps

---

Modified: src/core/lump_struct.h
Modified: src/core/msg_translator.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/40c9f5d157ca5f04b5f09369c72d6dbcb892e1d6.diff
Patch: 
https://github.com/kamailio/kamailio/commit/40c9f5d157ca5f04b5f09369c72d6dbcb892e1d6.patch

---

diff --git a/src/core/lump_struct.h b/src/core/lump_struct.h
index 192c2179e50..4c47e1436fc 100644
--- a/src/core/lump_struct.h
+++ b/src/core/lump_struct.h
@@ -86,13 +86,14 @@ enum lump_conditions
 
 enum lump_flag
 {
-       LUMPFLAG_NONE = 0,         /* */
-       LUMPFLAG_DUPED = 1,        /* lump struct duplicated in pkg, with value
+       LUMPFLAG_NONE = 0,              /* */
+       LUMPFLAG_DUPED = 1,             /* lump struct duplicated in pkg, with 
value
                                                                        * 
pointing to initial lump structure
                                                                        * - 
e.g., used for branch_route execution */
-       LUMPFLAG_SHMEM = 2,        /* lump stored in shared memory (e.g., tm) */
-       LUMPFLAG_BRANCH = 4,   /* not in use ?!? */
-       LUMPFLAG_COND_TRUE = 8 /* conditional lump processing */
+       LUMPFLAG_SHMEM = 2,             /* lump stored in shared memory (e.g., 
tm) */
+       LUMPFLAG_BRANCH = 4,    /* not in use ?!? */
+       LUMPFLAG_COND_TRUE = 8, /* conditional lump processing */
+       LUMPFLAG_APPLIED = 16   /* lump already applied */
 };
 
 #define LUMP_SET_COND_TRUE(_lump) (_lump)->flags |= LUMPFLAG_COND_TRUE
diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c
index 5cf2379e011..8671e6753d4 100644
--- a/src/core/msg_translator.c
+++ b/src/core/msg_translator.c
@@ -890,9 +890,13 @@ static inline int lumps_len(
        }
 
        for(t = lumps; t; t = t->next) {
+               if(t->flags & LUMPFLAG_APPLIED) {
+                       continue;
+               }
                /* skip if this is an OPT lump and the condition is not 
satisfied */
-               if((t->op == LUMP_ADD_OPT) && !lump_check_opt(t, msg, 
send_info))
+               if((t->op == LUMP_ADD_OPT) && !lump_check_opt(t, msg, 
send_info)) {
                        continue;
+               }
                for(r = t->before; r; r = r->before) {
                        switch(r->op) {
                                case LUMP_ADD:
@@ -1430,6 +1434,10 @@ void process_lumps(struct sip_msg *msg, struct lump 
*lumps, char *new_buf,
        s_offset = *orig_offs;
 
        for(t = lumps; t; t = t->next) {
+               if(t->flags & LUMPFLAG_APPLIED) {
+                       continue;
+               }
+               t->flags |= LUMPFLAG_APPLIED;
                switch(t->op) {
                        case LUMP_ADD:
                        case LUMP_ADD_SUBST:

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to