I always thought about writing a dialer, you know a thing that gets
called when you open a browser or ftp app and do not yet have internet
access (for example, if you have a DSL modem) like in Windows.
What I need to know in order to do this are these 2 things:
1.) is an application requesting for internet access ?
2.) is there already a working internet connection or not ?
I don't know how Windows solves the problem (I guess they built the
request into the apps like IE or Outlook which at least solves 1.)
Now I experimented with the output of netstat. My observations are these
for 2.):
a.) netstat -r the routing table is empty (apart from loopback) when no
internet connection is active
b.) netstat -a shows only the loopback when no internet connection, else
it shows 2 addresses (the loopback and the WAN address)
Questions:
a.) How do I tackle 1.) ?
b.) when I query "netstat -a output equivalent" via the socket API
(NETSTAT ioctl calls) I always only see loopback address but never the
2. address even if I have internet access.
Can someone enlighten me what would be a good way to answer questions
1.) and 2.) ?
Thanks,
Lars
Injoy solves the problem by creating another interface (Serial interface
dod), and monitoring that. From netstat -a here
...
addr 111.222.111.0 Interface 10 mask 0xffffff00 broadcast 111.222.111.0
Multicast addrs:
224.0.0.1
addr 207.xxx.xxx.xxx Interface 11 mask 0xffffff00 broadcast 207.xxx.xxx.xxx
Multicast addrs:
224.0.0.1
I also have localhost and a local 192.168.0.x network locally. The
207.xxx.xxx.xxx address (which I've blotted out most of) is PPP1 and
only there when dialed in. DOIP uses PPP0
Dave
a few questions:
1.) what does "serial interface dod" mean (dod ?)
2.) are you saying that InJoy dials in automatically ? But what does it
do with the additional interface and what does it monitor ?
3.) Is 111.222.111.0 PPP0 ?
4.) What does DOIP mean ? If it is data traffic: how can it go to PPP0
when in fact PPP1 is the interface to the outside world ?
Lars
Dave Yeo schrieb:
Well the modem is connected to the serial port and Injoy supports dial
on demand (dod)
> 2.) are you saying that InJoy dials in automatically ? But what does it
> do with the additional interface and what does it monitor ?
Yes Injoy dials in automatically. I guess the routing table is setup in
such a way that when attempt to connect to the internet by eg posting
this message, the packets go to the serial interface dod (I see the
traffic in ipspeed as outward bound on serial interface dod) get routed
to nul: or eaten by Injoy while dialing in then routed to PPP1.
The serial interface dod seems to have priority over the local LAN. If I
turn of dial on demand in Injoy then I see packets attempting to go to
the other computer on 192.168.0.x.
I also sometimes see, when dialing is slow, messages in Injoy, eg
11:46:01 DOD: Discarding packet (pre-connection queue exhausted)
so Injoy must queue up the packets internally.
> 3.) Is 111.222.111.0 PPP0 ?
No
> 4.) What does DOIP mean ? If it is data traffic: how can it go to PPP0
> when in fact PPP1 is the interface to the outside world ?
DOIP is Dial Other Internet Providers which comes with Warp v3+. It is
just a graphical interface to \mptn[tcpip]\bin\ppp.exe. If I open it up
and use it to dial, DOIP will use PPP0 for routing. This way it is
possible to have 2 dialers taking turns and may even be possible to have
2 modems connected at once though I have never tried. Also while
switching back and forth between the dialers usually works, sometimes
things get confused forcing a reboot to straighten it out. I only use
DOIP for trouble shooting.
Dave
That goes above my head. On the other head, an article I read triggered
another idea: I just set up a socket to listen on port 53 (DNS) on any
arbitrary internet address. TCP/IP API allows to peek at packets without
actually reading them.
Question is: What do I do if I actually get a DNS request from an
application ? Do I close the socket ? And, in case of peek, will the packet
contents go to the next receiver listening on port 53 (that would be the
real DNS server in WAN once the connection is set up) ?
>
>> 3.) Is 111.222.111.0 PPP0 ?
>
> No
So what is 111.222.111.0 ? And what address does PPP0 have ? Or is PPP0 the
interface that is created when DOIP is used (see below) ? If yes, what IP
address would PPP0 have ?
>
>> 4.) What does DOIP mean ? If it is data traffic: how can it go to PPP0
>> when in fact PPP1 is the interface to the outside world ?
>
> DOIP is Dial Other Internet Providers which comes with Warp v3+. It is
> just a graphical interface to \mptn[tcpip]\bin\ppp.exe. If I open it up
> and use it to dial, DOIP will use PPP0 for routing. This way it is
> possible to have 2 dialers taking turns and may even be possible to have 2
> modems connected at once though I have never tried. Also while switching
> back and forth between the dialers usually works, sometimes things get
> confused forcing a reboot to straighten it out. I only use DOIP for
> trouble shooting.
> Dave
Ah, ok.
Lars
I just did an experiment. Shutdown Injoy so no 111.222.111.0 interface,
just the local 192.168.0.x network. Tried checking my mail and dialing
in with DOIP. PMMail stalled with resolving pop server until DOIP had
finished connecting and setting up the default route through the remote
IP address then PMMail downloaded my mail.
I'm pretty sure that without the LAN setup PMMail used to error out.
>>> 3.) Is 111.222.111.0 PPP0 ?
>> No
>
> So what is 111.222.111.0 ? And what address does PPP0 have ? Or is PPP0 the
> interface that is created when DOIP is used (see below) ? If yes, what IP
> address would PPP0 have ?
PPP0 (and PPP1) get whatever address I get assigned by DHCP. You can
also set a permanent IP when creating the interface by passing the
address to ppp.exe (or setting it in injoy). The TCP/IP Command
Reference has a (bad) reference for ppp.exe.
>
>>> 4.) What does DOIP mean ? If it is data traffic: how can it go to PPP0
>>> when in fact PPP1 is the interface to the outside world ?
>> DOIP is Dial Other Internet Providers which comes with Warp v3+. It is
>> just a graphical interface to \mptn[tcpip]\bin\ppp.exe. If I open it up
>> and use it to dial, DOIP will use PPP0 for routing. This way it is
>> possible to have 2 dialers taking turns and may even be possible to have 2
>> modems connected at once though I have never tried. Also while switching
>> back and forth between the dialers usually works, sometimes things get
>> confused forcing a reboot to straighten it out. I only use DOIP for
>> trouble shooting.
>> Dave
>
> Ah, ok.
>
Also I should mention that diald on Linux used sort of the same idea
except it used the slip interface instead of Injoys serial interface
dod. You might get some ideas from looking at the diald FAQ
(http://diald.sourceforge.net/FAQ/diald-faq.html) and code,
http://sourceforge.net/projects/diald.
Dave
>> So what is 111.222.111.0 ? And what address does PPP0 have ? Or is PPP0
>> the
>> interface that is created when DOIP is used (see below) ? If yes, what IP
>> address would PPP0 have ?
>
> PPP0 (and PPP1) get whatever address I get assigned by DHCP. You can also
> set a permanent IP when creating the interface by passing the address to
> ppp.exe (or setting it in injoy). The TCP/IP Command Reference has a (bad)
> reference for ppp.exe.
Ah, you have up to 2 PPP connections, one for DOIP (modem dial in) and one
with InJoy (DSL access I suppose). Correct ?
>
>>
>>>> 4.) What does DOIP mean ? If it is data traffic: how can it go to PPP0
>>>> when in fact PPP1 is the interface to the outside world ?
>>> DOIP is Dial Other Internet Providers which comes with Warp v3+. It is
>>> just a graphical interface to \mptn[tcpip]\bin\ppp.exe. If I open it up
>>> and use it to dial, DOIP will use PPP0 for routing. This way it is
>>> possible to have 2 dialers taking turns and may even be possible to have
>>> 2
>>> modems connected at once though I have never tried. Also while switching
>>> back and forth between the dialers usually works, sometimes things get
>>> confused forcing a reboot to straighten it out. I only use DOIP for
>>> trouble shooting.
>>> Dave
>>
>> Ah, ok.
>>
>
> Also I should mention that diald on Linux used sort of the same idea
> except it used the slip interface instead of Injoys serial interface dod.
> You might get some ideas from looking at the diald FAQ
> (http://diald.sourceforge.net/FAQ/diald-faq.html) and code,
> http://sourceforge.net/projects/diald.
> Dave
That could be helpful. Even though I fear my network knowledge is too
limited to build such a thing. But, since OS/2 TCP/IP stack is BSD compliant
(almost all of the socket and TCP services API), maybe I can port that
application.
P.S. : the "listen on the DNS port" approach didn't work. That's because I
was listening on LOCAL port 53 while I would need to listen to FOREIGN port
53 (which obviously I cannot do).
Lars
Both the PPP connections are hooked up to the modem. I just usually use
Injoy which by default uses PPP1.
Dave
You are still using analog modem ? :-)
Lars
Yes, only choice where I live unluckily.
Dave