Skip to content

Commit

Permalink
topology_hiding: do not mark the contacts parts as HDR_CONTACT_T
Browse files Browse the repository at this point in the history
This ensures that when a fixed contact is restored from a shm lump, it
does not overlap to contact parts, as topology hiding builds them.

Many thanks to David Trihy from Genesys for reporting and helping us
troubleshoot.
  • Loading branch information
razvancrainea committed Sep 3, 2024
1 parent 307a986 commit e65173f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion modules/tm/t_msgbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static inline int fix_fake_req_headers(struct sip_msg *req)
for (c = ((contact_body_t *)hdr->parsed)->contacts; c; c = c->next) {
/* search for the lump */
for (ld = req->add_rm; ld; ld = ld->next) {
if (ld->op != LUMP_DEL)
if (ld->op != LUMP_DEL && ld->op != LUMP_NOP)
continue;
for (la = ld->after; la; la = la->after) {
/* LM_DBG("matching contact lump op=%d type=%d offset=%d"
Expand Down
14 changes: 7 additions & 7 deletions modules/topology_hiding/topo_hiding_logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ static int topo_dlg_replace_contact(struct sip_msg* msg, struct dlg_cell* dlg, i
goto error;
}

if ((lump = insert_new_lump_after(lump, prefix, ct->len, HDR_CONTACT_T)) == 0) {
if ((lump = insert_new_lump_after(lump, prefix, ct->len, 0)) == 0) {
LM_ERR("failed inserting '%.*s'\n", ct->len, prefix);
goto error;
}
Expand Down Expand Up @@ -597,19 +597,19 @@ static int topo_dlg_replace_contact(struct sip_msg* msg, struct dlg_cell* dlg, i
goto error;
}

if ((lump = insert_new_lump_after(lump,prefix,prefix_len,HDR_CONTACT_T)) == 0) {
if ((lump = insert_new_lump_after(lump,prefix,prefix_len,0)) == 0) {
LM_ERR("failed inserting '<sip:'\n");
goto error;
}
/* make sure we do not free this string in case of a further error */
prefix = NULL;

if ((lump = insert_subst_lump_after(lump, SUBST_SND_ALL, HDR_CONTACT_T)) == 0) {
if ((lump = insert_subst_lump_after(lump, SUBST_SND_ALL, 0)) == 0) {
LM_ERR("failed inserting SUBST_SND buf\n");
goto error;
}

if ((lump = insert_new_lump_after(lump,suffix,suffix_len,HDR_CONTACT_T)) == 0) {
if ((lump = insert_new_lump_after(lump,suffix,suffix_len,0)) == 0) {
LM_ERR("failed inserting '<sip:'\n");
goto error;
}
Expand Down Expand Up @@ -1775,7 +1775,7 @@ static int topo_no_dlg_encode_contact(struct sip_msg *msg,int flags, str *routes
prefix[prefix_len-1] = '@';
}

if (!(lump = insert_new_lump_after(lump,prefix,prefix_len,HDR_CONTACT_T))) {
if (!(lump = insert_new_lump_after(lump,prefix,prefix_len,0))) {
LM_ERR("failed inserting '<sip:'\n");
goto error;
}
Expand All @@ -1787,12 +1787,12 @@ static int topo_no_dlg_encode_contact(struct sip_msg *msg,int flags, str *routes
goto error;
}

if (!(lump = insert_subst_lump_after(lump, SUBST_SND_ALL, HDR_CONTACT_T))) {
if (!(lump = insert_subst_lump_after(lump, SUBST_SND_ALL, 0))) {
LM_ERR("failed inserting SUBST_SND buf\n");
goto error;
}

if (!(lump = insert_new_lump_after(lump,suffix,suffix_len,HDR_CONTACT_T))) {
if (!(lump = insert_new_lump_after(lump,suffix,suffix_len,0))) {
LM_ERR("failed inserting '<sip:'\n");
goto error;
}
Expand Down

0 comments on commit e65173f

Please sign in to comment.