2008-07-03 12:59:25

by Jens-Michael Hoffmann

[permalink] [raw]
Subject: tcp/ip connect on demand


hi,

what is the right way to implement a "connect on demand" feature?
Example: user types url in firefox and presses return. Then
the system should set up network devices and proceed as usual.

Is there a hook in the kernel we can use?

Best regards

Jens-Michael Hoffmann

ps: please cc me in replies since I'am not subscribed with this email.


2008-07-03 18:29:24

by H. Peter Anvin

[permalink] [raw]
Subject: Re: tcp/ip connect on demand

Jens-Michael Hoffmann wrote:
> hi,
>
> what is the right way to implement a "connect on demand" feature?
> Example: user types url in firefox and presses return. Then
> the system should set up network devices and proceed as usual.
>
> Is there a hook in the kernel we can use?

In the kernel, no. Nor do you need one; the best place to hook into
this is probably the name service system (so you catch it on trying to
look up hostnames.)

Alternatively, you can set up a bridge device which you can listen to
via a tap device; when you see traffic, you bring up the real network
and attach it to the bridge.

-hpa

2008-07-03 19:07:28

by Jan Engelhardt

[permalink] [raw]
Subject: Re: tcp/ip connect on demand


On Thursday 2008-07-03 20:28, H. Peter Anvin wrote:
> Jens-Michael Hoffmann wrote:
>> hi,
>>
>> what is the right way to implement a "connect on demand" feature?
>> Example: user types url in firefox and presses return. Then
>> the system should set up network devices and proceed as usual.
>>
>> Is there a hook in the kernel we can use?
>
> In the kernel, no. Nor do you need one; the best place to hook into this is
> probably the name service system (so you catch it on trying to look up
> hostnames.)
>
> Alternatively, you can set up a bridge device which you can listen to via a tap
> device; when you see traffic, you bring up the real network and attach it to
> the bridge.

There is on-demand for PPP devices; though that is probably specific
to PPP.

2008-07-03 19:16:08

by H. Peter Anvin

[permalink] [raw]
Subject: Re: tcp/ip connect on demand

Jan Engelhardt wrote:
> On Thursday 2008-07-03 20:28, H. Peter Anvin wrote:
>> Jens-Michael Hoffmann wrote:
>>> hi,
>>>
>>> what is the right way to implement a "connect on demand" feature?
>>> Example: user types url in firefox and presses return. Then
>>> the system should set up network devices and proceed as usual.
>>>
>>> Is there a hook in the kernel we can use?
>> In the kernel, no. Nor do you need one; the best place to hook into this is
>> probably the name service system (so you catch it on trying to look up
>> hostnames.)
>>
>> Alternatively, you can set up a bridge device which you can listen to via a tap
>> device; when you see traffic, you bring up the real network and attach it to
>> the bridge.
>
> There is on-demand for PPP devices; though that is probably specific
> to PPP.

Yes, those monitor traffic at the PPP device port, I believe.

-hpa