openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* ClientOriginIPAddress is 0.0.0.0 or ""
@ 2021-03-05  8:05 Jun-Lin Chen (陳俊霖)
  2021-03-18  6:23 ` Jun-Lin Chen (陳俊霖)
  0 siblings, 1 reply; 7+ messages in thread
From: Jun-Lin Chen (陳俊霖) @ 2021-03-05  8:05 UTC (permalink / raw)
  To: sunharis; +Cc: openbmc

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]

Hi Sunitha,

I found some problem when I create session.
The property “ClientOriginIPAddress” is “” after POST https://${bmc}/login<https://$%7bbmc%7d/login> -d '{"username": <>,"password": <>}
And it is 0.0.0.0 after POST https://${bmc}/redfish/v1/SessionService/Sessions<https://$%7bbmc%7d/redfish/v1/SessionService/Sessions> -d '{"username": <>,"password": <>}'
Both of them looked like something wrong. And I also look for source code in bmcweb repository.
There only defined the default value: “” in generateUserSession() and not found fetch user ip in elsewhere.
I think it is why ClientOriginIPAddress is strange.

May I ask what step or something I lack in creation session so this property is abnormal?


Best regards,
Jun-Lin Chen


[-- Attachment #2: Type: text/html, Size: 3729 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: ClientOriginIPAddress is 0.0.0.0 or ""
  2021-03-05  8:05 ClientOriginIPAddress is 0.0.0.0 or "" Jun-Lin Chen (陳俊霖)
@ 2021-03-18  6:23 ` Jun-Lin Chen (陳俊霖)
  2021-04-06 16:51   ` Ed Tanous
  0 siblings, 1 reply; 7+ messages in thread
From: Jun-Lin Chen (陳俊霖) @ 2021-03-18  6:23 UTC (permalink / raw)
  To: openbmc

[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]

Hi,
If continously send POST sessions Redfish request via Postman. I observe bmcweb debug logs, it will established connection at first request then not fetch user ip after the second request.

That's why ClientOriginIPAddress in session after the second created is always 0.0.0.0 (not be assigned).

In HTTP 1.1 It uses keep-alive Header default. so BMC does not fetch user IP when its connection is established.

Is this behavior we expect?

Best regards,
Jun-Lin Chen

From: Jun-Lin Chen (陳俊霖)
Sent: Friday, March 5, 2021 4:05 PM
To: sunharis@in.ibm.com
Cc: openbmc@lists.ozlabs.org
Subject: ClientOriginIPAddress is 0.0.0.0 or ""

Hi Sunitha,

I found some problem when I create session.
The property “ClientOriginIPAddress” is “” after POST https://${bmc}/login<https://$%7bbmc%7d/login> -d '{"username": <>,"password": <>}
And it is 0.0.0.0 after POST https://${bmc}/redfish/v1/SessionService/Sessions<https://$%7bbmc%7d/redfish/v1/SessionService/Sessions> -d '{"username": <>,"password": <>}'
Both of them looked like something wrong. And I also look for source code in bmcweb repository.
There only defined the default value: “” in generateUserSession() and not found fetch user ip in elsewhere.
I think it is why ClientOriginIPAddress is strange.

May I ask what step or something I lack in creation session so this property is abnormal?


Best regards,
Jun-Lin Chen


[-- Attachment #2: Type: text/html, Size: 6121 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ClientOriginIPAddress is 0.0.0.0 or ""
  2021-03-18  6:23 ` Jun-Lin Chen (陳俊霖)
@ 2021-04-06 16:51   ` Ed Tanous
  2021-04-09  5:51     ` Sunitha Harish
  0 siblings, 1 reply; 7+ messages in thread
From: Ed Tanous @ 2021-04-06 16:51 UTC (permalink / raw)
  To: Jun-Lin Chen (陳俊霖), sunithaharish04; +Cc: openbmc

On Tue, Mar 23, 2021 at 3:28 PM Jun-Lin Chen (陳俊霖)
<Jun-Lin.Chen@quantatw.com> wrote:
>
> Hi,
>
> If continously send POST sessions Redfish request via Postman. I observe bmcweb debug logs, it will established connection at first request then not fetch user ip after the second request.
>
>
>
> That's why ClientOriginIPAddress in session after the second created is always 0.0.0.0 (not be assigned).
>
>
>
> In HTTP 1.1 It uses keep-alive Header default. so BMC does not fetch user IP when its connection is established.
>
>
>
> Is this behavior we expect?
>
>
>
> Best regards,
>
> Jun-Lin Chen


Sunitha,
Considering this is code you wrote, would you mind replying to Jun-Lin
about his experience and what the expected behavior is?  For what it's
worth, I've seen it report 0.0.0.0 before on my system, I just haven't
had a chance to chase it down and debug it.

-Ed

>
>
>
> From: Jun-Lin Chen (陳俊霖)
> Sent: Friday, March 5, 2021 4:05 PM
> To: sunharis@in.ibm.com
> Cc: openbmc@lists.ozlabs.org
> Subject: ClientOriginIPAddress is 0.0.0.0 or ""
>
>
>
> Hi Sunitha,
>
>
>
> I found some problem when I create session.
>
> The property “ClientOriginIPAddress” is “” after POST https://${bmc}/login -d '{"username": <>,"password": <>}
>
> And it is 0.0.0.0 after POST https://${bmc}/redfish/v1/SessionService/Sessions -d '{"username": <>,"password": <>}'
>
> Both of them looked like something wrong. And I also look for source code in bmcweb repository.
>
> There only defined the default value: “” in generateUserSession() and not found fetch user ip in elsewhere.
>
> I think it is why ClientOriginIPAddress is strange.
>
>
>
> May I ask what step or something I lack in creation session so this property is abnormal?
>
>
>
>
>
> Best regards,
>
> Jun-Lin Chen
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ClientOriginIPAddress is 0.0.0.0 or ""
  2021-04-06 16:51   ` Ed Tanous
@ 2021-04-09  5:51     ` Sunitha Harish
  2021-04-09 14:58       ` Ed Tanous
  0 siblings, 1 reply; 7+ messages in thread
From: Sunitha Harish @ 2021-04-09  5:51 UTC (permalink / raw)
  To: Ed Tanous, Jun-Lin Chen (陳俊霖); +Cc: openbmc


On 06-04-2021 22:21, Ed Tanous wrote:
> On Tue, Mar 23, 2021 at 3:28 PM Jun-Lin Chen (陳俊霖)
> <Jun-Lin.Chen@quantatw.com> wrote:
>> Hi,
>>
>> If continously send POST sessions Redfish request via Postman. I observe bmcweb debug logs, it will established connection at first request then not fetch user ip after the second request.
>>
>>
>>
>> That's why ClientOriginIPAddress in session after the second created is always 0.0.0.0 (not be assigned).
>>
>>
>>
>> In HTTP 1.1 It uses keep-alive Header default. so BMC does not fetch user IP when its connection is established.
>>
>>
>>
>> Is this behavior we expect?
>>
>>
>>
>> Best regards,
>>
>> Jun-Lin Chen
>
> Sunitha,
> Considering this is code you wrote, would you mind replying to Jun-Lin
> about his experience and what the expected behavior is?  For what it's
> worth, I've seen it report 0.0.0.0 before on my system, I just haven't
> had a chance to chase it down and debug it.
>
> -Ed

Hi Jun-Lin,

The ClientOriginIPAddress is expected to get populated when the session 
is established to the BMC ( the first request). This is a one time 
fetch, and it will be persisted for that session.

Regards,
Sunitha
>>
>>
>> From: Jun-Lin Chen (陳俊霖)
>> Sent: Friday, March 5, 2021 4:05 PM
>> To: sunharis@in.ibm.com
>> Cc: openbmc@lists.ozlabs.org
>> Subject: ClientOriginIPAddress is 0.0.0.0 or ""
>>
>>
>>
>> Hi Sunitha,
>>
>>
>>
>> I found some problem when I create session.
>>
>> The property “ClientOriginIPAddress” is “” after POST https://${bmc}/login -d '{"username": <>,"password": <>}
>>
>> And it is 0.0.0.0 after POST https://${bmc}/redfish/v1/SessionService/Sessions -d '{"username": <>,"password": <>}'
>>
>> Both of them looked like something wrong. And I also look for source code in bmcweb repository.
>>
>> There only defined the default value: “” in generateUserSession() and not found fetch user ip in elsewhere.
>>
>> I think it is why ClientOriginIPAddress is strange.
>>
>>
>>
>> May I ask what step or something I lack in creation session so this property is abnormal?
>>
>>
>>
>>
>>
>> Best regards,
>>
>> Jun-Lin Chen
>>
>>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ClientOriginIPAddress is 0.0.0.0 or ""
  2021-04-09  5:51     ` Sunitha Harish
@ 2021-04-09 14:58       ` Ed Tanous
  2021-04-16 13:42         ` Ivan Mikhaylov
  0 siblings, 1 reply; 7+ messages in thread
From: Ed Tanous @ 2021-04-09 14:58 UTC (permalink / raw)
  To: Sunitha Harish; +Cc: Jun-Lin Chen (陳俊霖), openbmc

On Thu, Apr 8, 2021 at 10:51 PM Sunitha Harish
<sunithaharish04@gmail.com> wrote:
>
>
> On 06-04-2021 22:21, Ed Tanous wrote:
> > On Tue, Mar 23, 2021 at 3:28 PM Jun-Lin Chen (陳俊霖)
> > <Jun-Lin.Chen@quantatw.com> wrote:
> >> Hi,
> >>
> >> If continously send POST sessions Redfish request via Postman. I observe bmcweb debug logs, it will established connection at first request then not fetch user ip after the second request.
> >>
> >>
> >>
> >> That's why ClientOriginIPAddress in session after the second created is always 0.0.0.0 (not be assigned).
> >>
> >>
> >>
> >> In HTTP 1.1 It uses keep-alive Header default. so BMC does not fetch user IP when its connection is established.
> >>
> >>
> >>
> >> Is this behavior we expect?
> >>
> >>
> >>
> >> Best regards,
> >>
> >> Jun-Lin Chen
> >
> > Sunitha,
> > Considering this is code you wrote, would you mind replying to Jun-Lin
> > about his experience and what the expected behavior is?  For what it's
> > worth, I've seen it report 0.0.0.0 before on my system, I just haven't
> > had a chance to chase it down and debug it.
> >
> > -Ed
>
> Hi Jun-Lin,
>
> The ClientOriginIPAddress is expected to get populated when the session
> is established to the BMC ( the first request). This is a one time
> fetch, and it will be persisted for that session.

Can you think of a reason it would report all zeros?  Can you verify
this functionality works properly on your system?
Part of me wonders if this has something to do with http keepalive.

>
> Regards,
> Sunitha
> >>
> >>
> >> From: Jun-Lin Chen (陳俊霖)
> >> Sent: Friday, March 5, 2021 4:05 PM
> >> To: sunharis@in.ibm.com
> >> Cc: openbmc@lists.ozlabs.org
> >> Subject: ClientOriginIPAddress is 0.0.0.0 or ""
> >>
> >>
> >>
> >> Hi Sunitha,
> >>
> >>
> >>
> >> I found some problem when I create session.
> >>
> >> The property “ClientOriginIPAddress” is “” after POST https://${bmc}/login -d '{"username": <>,"password": <>}
> >>
> >> And it is 0.0.0.0 after POST https://${bmc}/redfish/v1/SessionService/Sessions -d '{"username": <>,"password": <>}'
> >>
> >> Both of them looked like something wrong. And I also look for source code in bmcweb repository.
> >>
> >> There only defined the default value: “” in generateUserSession() and not found fetch user ip in elsewhere.
> >>
> >> I think it is why ClientOriginIPAddress is strange.
> >>
> >>
> >>
> >> May I ask what step or something I lack in creation session so this property is abnormal?
> >>
> >>
> >>
> >>
> >>
> >> Best regards,
> >>
> >> Jun-Lin Chen
> >>
> >>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ClientOriginIPAddress is 0.0.0.0 or ""
  2021-04-09 14:58       ` Ed Tanous
@ 2021-04-16 13:42         ` Ivan Mikhaylov
  2021-04-16 14:57           ` Ed Tanous
  0 siblings, 1 reply; 7+ messages in thread
From: Ivan Mikhaylov @ 2021-04-16 13:42 UTC (permalink / raw)
  To: Ed Tanous, Sunitha Harish
  Cc: Jun-Lin Chen (陳俊霖), openbmc

On Fri, 2021-04-09 at 07:58 -0700, Ed Tanous wrote:
> On Thu, Apr 8, 2021 at 10:51 PM Sunitha Harish
> <sunithaharish04@gmail.com> wrote:
> > 
> > On 06-04-2021 22:21, Ed Tanous wrote:
> > > On Tue, Mar 23, 2021 at 3:28 PM Jun-Lin Chen (陳俊霖)
> > > <Jun-Lin.Chen@quantatw.com> wrote:
> > > > Hi,
> > > > 
> > > > If continously send POST sessions Redfish request via Postman. I observe
> > > > bmcweb debug logs, it will established connection at first request then
> > > > not fetch user ip after the second request.
> > > > 
> > > > 
> > > > 
> > > > That's why ClientOriginIPAddress in session after the second created is
> > > > always 0.0.0.0 (not be assigned).
> > > > 
> > > > 
> > > > 
> > > > In HTTP 1.1 It uses keep-alive Header default. so BMC does not fetch
> > > > user IP when its connection is established.
> > > > 
> > > > 
> > > > 
> > > > Is this behavior we expect?
> > > > 
> > > > 
> > > > 
> > > > Best regards,
> > > > 
> > > > Jun-Lin Chen
> > > 
> > > Sunitha,
> > > Considering this is code you wrote, would you mind replying to Jun-Lin
> > > about his experience and what the expected behavior is?  For what it's
> > > worth, I've seen it report 0.0.0.0 before on my system, I just haven't
> > > had a chance to chase it down and debug it.
> > > 
> > > -Ed
> > 
> > Hi Jun-Lin,
> > 
> > The ClientOriginIPAddress is expected to get populated when the session
> > is established to the BMC ( the first request). This is a one time
> > fetch, and it will be persisted for that session.
> 
> Can you think of a reason it would report all zeros?  Can you verify
> this functionality works properly on your system?
> Part of me wonders if this has something to do with http keepalive.
> 
> > Regards,
> > Sunitha
> > > > 
> > > > From: Jun-Lin Chen (陳俊霖)
> > > > Sent: Friday, March 5, 2021 4:05 PM
> > > > To: sunharis@in.ibm.com
> > > > Cc: openbmc@lists.ozlabs.org
> > > > Subject: ClientOriginIPAddress is 0.0.0.0 or ""
> > > > 
> > > > 
> > > > 
> > > > Hi Sunitha,
> > > > 
> > > > 
> > > > 
> > > > I found some problem when I create session.
> > > > 
> > > > The property “ClientOriginIPAddress” is “” after POST
> > > > https://${bmc}/login -d '{"username": <>,"password": <>}
> > > > 
> > > > And it is 0.0.0.0 after POST
> > > > https://${bmc}/redfish/v1/SessionService/Sessions -d '{"username":
> > > > <>,"password": <>}'
> > > > 
> > > > Both of them looked like something wrong. And I also look for source
> > > > code in bmcweb repository.
> > > > 
> > > > There only defined the default value: “” in generateUserSession() and
> > > > not found fetch user ip in elsewhere.
> > > > 
> > > > I think it is why ClientOriginIPAddress is strange.
> > > > 
> > > > 
> > > > 
> > > > May I ask what step or something I lack in creation session so this
> > > > property is abnormal?
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > Best regards,
> > > > 
> > > > Jun-Lin Chen
> > > > 
> > > > 

Hello Ed, I made some research at this point, ipAddress always sets to 0.0.0.0
after first Request, it is done by req.emplace(parser->get()) in doWrite
function in http/http_connection.h. fetchClientIp sets ipAddress only on
connection start. It is possible to fix it with additional fetchClientIp inside
handle function which seems overhead or

ipAddress = req->ipAddress;
req.emplace(parser->get());
req->ipAddress = ipAddress;

I don't like both variants but possible that ipAddress shouldn't be a part of
Request struct.

Any ideas?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ClientOriginIPAddress is 0.0.0.0 or ""
  2021-04-16 13:42         ` Ivan Mikhaylov
@ 2021-04-16 14:57           ` Ed Tanous
  0 siblings, 0 replies; 7+ messages in thread
From: Ed Tanous @ 2021-04-16 14:57 UTC (permalink / raw)
  To: Ivan Mikhaylov
  Cc: Jun-Lin Chen (陳俊霖), Sunitha Harish, openbmc

On Fri, Apr 16, 2021 at 6:34 AM Ivan Mikhaylov <i.mikhaylov@yadro.com> wrote:
>
> On Fri, 2021-04-09 at 07:58 -0700, Ed Tanous wrote:
> > On Thu, Apr 8, 2021 at 10:51 PM Sunitha Harish
> > <sunithaharish04@gmail.com> wrote:
> > >
> > > On 06-04-2021 22:21, Ed Tanous wrote:
> > > > On Tue, Mar 23, 2021 at 3:28 PM Jun-Lin Chen (陳俊霖)
> > > > <Jun-Lin.Chen@quantatw.com> wrote:
> > > > > Hi,
> > > > >
> > > > > If continously send POST sessions Redfish request via Postman. I observe
> > > > > bmcweb debug logs, it will established connection at first request then
> > > > > not fetch user ip after the second request.
> > > > >
> > > > >
> > > > >
> > > > > That's why ClientOriginIPAddress in session after the second created is
> > > > > always 0.0.0.0 (not be assigned).
> > > > >
> > > > >
> > > > >
> > > > > In HTTP 1.1 It uses keep-alive Header default. so BMC does not fetch
> > > > > user IP when its connection is established.
> > > > >
> > > > >
> > > > >
> > > > > Is this behavior we expect?
> > > > >
> > > > >
> > > > >
> > > > > Best regards,
> > > > >
> > > > > Jun-Lin Chen
> > > >
> > > > Sunitha,
> > > > Considering this is code you wrote, would you mind replying to Jun-Lin
> > > > about his experience and what the expected behavior is?  For what it's
> > > > worth, I've seen it report 0.0.0.0 before on my system, I just haven't
> > > > had a chance to chase it down and debug it.
> > > >
> > > > -Ed
> > >
> > > Hi Jun-Lin,
> > >
> > > The ClientOriginIPAddress is expected to get populated when the session
> > > is established to the BMC ( the first request). This is a one time
> > > fetch, and it will be persisted for that session.
> >
> > Can you think of a reason it would report all zeros?  Can you verify
> > this functionality works properly on your system?
> > Part of me wonders if this has something to do with http keepalive.
> >
> > > Regards,
> > > Sunitha
> > > > >
> > > > > From: Jun-Lin Chen (陳俊霖)
> > > > > Sent: Friday, March 5, 2021 4:05 PM
> > > > > To: sunharis@in.ibm.com
> > > > > Cc: openbmc@lists.ozlabs.org
> > > > > Subject: ClientOriginIPAddress is 0.0.0.0 or ""
> > > > >
> > > > >
> > > > >
> > > > > Hi Sunitha,
> > > > >
> > > > >
> > > > >
> > > > > I found some problem when I create session.
> > > > >
> > > > > The property “ClientOriginIPAddress” is “” after POST
> > > > > https://${bmc}/login -d '{"username": <>,"password": <>}
> > > > >
> > > > > And it is 0.0.0.0 after POST
> > > > > https://${bmc}/redfish/v1/SessionService/Sessions -d '{"username":
> > > > > <>,"password": <>}'
> > > > >
> > > > > Both of them looked like something wrong. And I also look for source
> > > > > code in bmcweb repository.
> > > > >
> > > > > There only defined the default value: “” in generateUserSession() and
> > > > > not found fetch user ip in elsewhere.
> > > > >
> > > > > I think it is why ClientOriginIPAddress is strange.
> > > > >
> > > > >
> > > > >
> > > > > May I ask what step or something I lack in creation session so this
> > > > > property is abnormal?
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Best regards,
> > > > >
> > > > > Jun-Lin Chen
> > > > >
> > > > >
>
> Hello Ed, I made some research at this point, ipAddress always sets to 0.0.0.0
> after first Request, it is done by req.emplace(parser->get()) in doWrite
> function in http/http_connection.h. fetchClientIp sets ipAddress only on
> connection start. It is possible to fix it with additional fetchClientIp inside
> handle function which seems overhead or
>
> ipAddress = req->ipAddress;
> req.emplace(parser->get());
> req->ipAddress = ipAddress;

Yep, this makes sense.  I would expect parsing the ip address to be
almost zero overhead (it should just be a memcpy), so it should be ok
to do on every request.  This is what I think we should do.

Sunitha,
Can you put together a patchset to fix the above and test it works as
expected on your system?

>
> I don't like both variants but possible that ipAddress shouldn't be a part of
> Request struct.

It's part of the request struct so we can separate any handler from
having to know anything about the connection semantics.  This makes it
so we at least have a hope of unit testing things in the future.

>
> Any ideas?
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-16 14:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05  8:05 ClientOriginIPAddress is 0.0.0.0 or "" Jun-Lin Chen (陳俊霖)
2021-03-18  6:23 ` Jun-Lin Chen (陳俊霖)
2021-04-06 16:51   ` Ed Tanous
2021-04-09  5:51     ` Sunitha Harish
2021-04-09 14:58       ` Ed Tanous
2021-04-16 13:42         ` Ivan Mikhaylov
2021-04-16 14:57           ` Ed Tanous

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).