Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sip: sip_conncfg_set pass by reference #582

Merged
merged 1 commit into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/re_sip.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ int sip_keepalive_start(struct sip_keepalive **kap, struct sip *sip,

/* sip_conncfg */
int sip_conncfg_set(struct sip *sip, const struct sa *paddr,
const struct sip_conncfg conncfg);
const struct sip_conncfg *conncfg);


/* sip_uas_auth */
Expand Down
7 changes: 4 additions & 3 deletions src/sip/transp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ void sip_transp_rmladdr(struct sip *sip, const struct sa *laddr)
* @return 0 if success, otherwise errorcode
*/
int sip_conncfg_set(struct sip *sip, const struct sa *paddr,
const struct sip_conncfg conncfg)
const struct sip_conncfg *conncfg)
{
struct sip_conncfg *cfg;

Expand All @@ -1882,7 +1882,7 @@ int sip_conncfg_set(struct sip *sip, const struct sa *paddr,

cfg = sip_conncfg_find(sip, paddr);
if (cfg) {
cfg->srcport = conncfg.srcport;
cfg->srcport = conncfg->srcport;
return 0;
}
else {
Expand All @@ -1892,9 +1892,10 @@ int sip_conncfg_set(struct sip *sip, const struct sa *paddr,
if (!cfg)
return ENOMEM;

memcpy(cfg, &conncfg, sizeof(*cfg));
memcpy(cfg, conncfg, sizeof(*cfg));
memset(&cfg->he, 0, sizeof(cfg->he));
sa_cpy(&cfg->paddr, paddr);
hash_append(sip->ht_conncfg, sa_hash(paddr, SA_ALL), &cfg->he, cfg);

return 0;
}
2 changes: 1 addition & 1 deletion src/sipreg/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ static int send_handler(enum sip_transp tp, struct sa *src,
struct sip_conncfg cfg;
memset(&cfg, 0, sizeof(cfg));
cfg.srcport = reg->srcport;
err = sip_conncfg_set(reg->sip, dst, cfg);
err = sip_conncfg_set(reg->sip, dst, &cfg);
}

return err;
Expand Down