bug in pjsua_acc.c?

TM
Tristan Matthews
Thu, Nov 14, 2013 11:05 PM

I noticed a few suspicious conditionals pertaining to contact rewrite, along the lines of
if (acc->cfg.allow_contact_rewrite != 2

However, allow_contact_rewrite is a pj_bool_t and should only ever be set to PJ_TRUE or PJ_FALSE.
I expect that the intentions was to write
if (acc->cfg.contact_rewrite_method != 2

I've attached a patch.

Best,
Tristan

--

Tristan Matthews
Développeur de logiciels libres
tristan.matthews@savoirfairelinux.com
Ligne directe: 514-276-5468 poste 190

Fax : 514-276-5465
7275 Saint Urbain
Bureau 200
Montréal, QC, H2R 2Y5

I noticed a few suspicious conditionals pertaining to contact rewrite, along the lines of if (acc->cfg.allow_contact_rewrite != 2 However, allow_contact_rewrite is a pj_bool_t and should only ever be set to PJ_TRUE or PJ_FALSE. I expect that the intentions was to write if (acc->cfg.contact_rewrite_method != 2 I've attached a patch. Best, Tristan -- Tristan Matthews Développeur de logiciels libres tristan.matthews@savoirfairelinux.com Ligne directe: 514-276-5468 poste 190 Fax : 514-276-5465 7275 Saint Urbain Bureau 200 Montréal, QC, H2R 2Y5
M
Ming
Fri, Nov 15, 2013 12:51 AM

Hi Tristan,

This is actually an undocumented feature to force re-registration even with
private IP, if allow_contact_rewrite is set to 2.

Regards,
Ming

On Fri, Nov 15, 2013 at 7:05 AM, Tristan Matthews <
tristan.matthews@savoirfairelinux.com> wrote:

I noticed a few suspicious conditionals pertaining to contact rewrite,
along the lines of
if (acc->cfg.allow_contact_rewrite != 2

However, allow_contact_rewrite is a pj_bool_t and should only ever be set
to PJ_TRUE or PJ_FALSE.
I expect that the intentions was to write
if (acc->cfg.contact_rewrite_method != 2

I've attached a patch.

Best,
Tristan

--

Tristan Matthews
Développeur de logiciels libres
tristan.matthews@savoirfairelinux.com
Ligne directe: 514-276-5468 poste 190

Fax : 514-276-5465
7275 Saint Urbain
Bureau 200
Montréal, QC, H2R 2Y5


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Tristan, This is actually an undocumented feature to force re-registration even with private IP, if allow_contact_rewrite is set to 2. Regards, Ming On Fri, Nov 15, 2013 at 7:05 AM, Tristan Matthews < tristan.matthews@savoirfairelinux.com> wrote: > I noticed a few suspicious conditionals pertaining to contact rewrite, > along the lines of > if (acc->cfg.allow_contact_rewrite != 2 > > However, allow_contact_rewrite is a pj_bool_t and should only ever be set > to PJ_TRUE or PJ_FALSE. > I expect that the intentions was to write > if (acc->cfg.contact_rewrite_method != 2 > > I've attached a patch. > > Best, > Tristan > > -- > > Tristan Matthews > Développeur de logiciels libres > tristan.matthews@savoirfairelinux.com > Ligne directe: 514-276-5468 poste 190 > > Fax : 514-276-5465 > 7275 Saint Urbain > Bureau 200 > Montréal, QC, H2R 2Y5 > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >
TM
Tristan Matthews
Fri, Nov 15, 2013 3:46 AM

----- Original Message -----

From: "Ming" ming@teluu.com
To: "pjsip list" pjsip@lists.pjsip.org
Sent: Thursday, November 14, 2013 7:51:40 PM
Subject: Re: [pjsip] bug in pjsua_acc.c?

Hi Tristan,

This is actually an undocumented feature to force re-registration
even with private IP, if allow_contact_rewrite is set to 2.

Ah, my mistake. Perhaps it should be changed to an enum then?

Best,
Tristan

--

Tristan Matthews
Développeur de logiciels libres
tristan.matthews@savoirfairelinux.com
Ligne directe: 514-276-5468 poste 190

Fax : 514-276-5465
7275 Saint Urbain
Bureau 200
Montréal, QC, H2R 2Y5

----- Original Message ----- > From: "Ming" <ming@teluu.com> > To: "pjsip list" <pjsip@lists.pjsip.org> > Sent: Thursday, November 14, 2013 7:51:40 PM > Subject: Re: [pjsip] bug in pjsua_acc.c? > > > > > Hi Tristan, > > This is actually an undocumented feature to force re-registration > even with private IP, if allow_contact_rewrite is set to 2. Ah, my mistake. Perhaps it should be changed to an enum then? Best, Tristan -- Tristan Matthews Développeur de logiciels libres tristan.matthews@savoirfairelinux.com Ligne directe: 514-276-5468 poste 190 Fax : 514-276-5465 7275 Saint Urbain Bureau 200 Montréal, QC, H2R 2Y5
M
Ming
Fri, Nov 15, 2013 5:09 AM

Hi Tristan,

You are right, integer/enum type would be better, but we also want to be
careful as to not change/break the API unnecessarily. Currently the feature
is only for testing and not needed by most, if not all, applications, so we
want to leave it as it is now, but it may change in the future if such need
arises.

Regards,
Ming

On Fri, Nov 15, 2013 at 11:46 AM, Tristan Matthews <
tristan.matthews@savoirfairelinux.com> wrote:

----- Original Message -----

From: "Ming" ming@teluu.com
To: "pjsip list" pjsip@lists.pjsip.org
Sent: Thursday, November 14, 2013 7:51:40 PM
Subject: Re: [pjsip] bug in pjsua_acc.c?

Hi Tristan,

This is actually an undocumented feature to force re-registration
even with private IP, if allow_contact_rewrite is set to 2.

Ah, my mistake. Perhaps it should be changed to an enum then?

Best,
Tristan

--

Tristan Matthews
Développeur de logiciels libres
tristan.matthews@savoirfairelinux.com
Ligne directe: 514-276-5468 poste 190

Fax : 514-276-5465
7275 Saint Urbain
Bureau 200
Montréal, QC, H2R 2Y5


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Tristan, You are right, integer/enum type would be better, but we also want to be careful as to not change/break the API unnecessarily. Currently the feature is only for testing and not needed by most, if not all, applications, so we want to leave it as it is now, but it may change in the future if such need arises. Regards, Ming On Fri, Nov 15, 2013 at 11:46 AM, Tristan Matthews < tristan.matthews@savoirfairelinux.com> wrote: > ----- Original Message ----- > > From: "Ming" <ming@teluu.com> > > To: "pjsip list" <pjsip@lists.pjsip.org> > > Sent: Thursday, November 14, 2013 7:51:40 PM > > Subject: Re: [pjsip] bug in pjsua_acc.c? > > > > > > > > > > Hi Tristan, > > > > This is actually an undocumented feature to force re-registration > > even with private IP, if allow_contact_rewrite is set to 2. > > Ah, my mistake. Perhaps it should be changed to an enum then? > > Best, > Tristan > > -- > > Tristan Matthews > Développeur de logiciels libres > tristan.matthews@savoirfairelinux.com > Ligne directe: 514-276-5468 poste 190 > > Fax : 514-276-5465 > 7275 Saint Urbain > Bureau 200 > Montréal, QC, H2R 2Y5 > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >
S
Salahuddin
Tue, Nov 19, 2013 12:40 PM

Sent from my iPhone

On Nov 15, 2013, at 1:05 AM, Tristan Matthews tristan.matthews@savoirfairelinux.com wrote:

I noticed a few suspicious conditionals pertaining to contact rewrite, along the lines of
if (acc->cfg.allow_contact_rewrite != 2

However, allow_contact_rewrite is a pj_bool_t and should only ever be set to PJ_TRUE or PJ_FALSE.
I expect that the intentions was to write
if (acc->cfg.contact_rewrite_method != 2

I've attached a patch.

Best,
Tristan

--

Tristan Matthews
Développeur de logiciels libres
tristan.matthews@savoirfairelinux.com
Ligne directe: 514-276-5468 poste 190

Fax : 514-276-5465
7275 Saint Urbain
Bureau 200
Montréal, QC, H2R 2Y5

<contact_rewrite.patch>


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Sent from my iPhone > On Nov 15, 2013, at 1:05 AM, Tristan Matthews <tristan.matthews@savoirfairelinux.com> wrote: > > I noticed a few suspicious conditionals pertaining to contact rewrite, along the lines of > if (acc->cfg.allow_contact_rewrite != 2 > > However, allow_contact_rewrite is a pj_bool_t and should only ever be set to PJ_TRUE or PJ_FALSE. > I expect that the intentions was to write > if (acc->cfg.contact_rewrite_method != 2 > > I've attached a patch. > > Best, > Tristan > > -- > > Tristan Matthews > Développeur de logiciels libres > tristan.matthews@savoirfairelinux.com > Ligne directe: 514-276-5468 poste 190 > > Fax : 514-276-5465 > 7275 Saint Urbain > Bureau 200 > Montréal, QC, H2R 2Y5 > > <contact_rewrite.patch> > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org