[openbeosnetteam] PPP: dial-on-demand

  • From: "Waldemar Kornewald" <Waldemar.Kornewald@xxxxxx>
  • To: "OpenBeOS Network" <openbeosnetteam@xxxxxxxxxxxxx>
  • Date: Tue, 1 Jul 2003 14:01:24 +0200

Hi,
before I implement something that would never work with our stack, could you
please help me with some (basic?) BSD stuff?
I plan to implement dial-on-demand the following way:
When an interface registers itself to the ppp_interface_manager it gets an
ifnet structure assigned.
The if_flags are set to IFF_UP | IFF_POINTTOPOINT.
This happens will all interfaces regardless whether dial-on-demand is set or
not.
The following is only done with dial-on-demand interfaces:

1) The IP Control Protocol adds itself as the default route and uses an
undefined class A dst address (?10.0.0.1 + if_unit?) and an undefined class
A interface address (?10.127.0.1 + if_unit?). BTW, do we have a function
that returns the netmask of some ip-address?
AFAIK, calling SIOCSIFDSTADDR also sets the default route automatically and
it has a special handling for IFF_POINTTOPOINT. Does it check if the return
value of the interface is ok and add the route only then?
Which ioctl should bring the interface up? SIOCSIFFLAGS or SIOCSIFADDR or
both?
How do I prevent changing the interface's ip?
Do I have to add an ifaddr for each protocol?

2) When the interface must send some data it Up()s itself. Up() adds
IFF_RUNNING to if_flags if it was successful.
All threads that try to send something are blocked and wait until Up() is
done. If Up() fails they delete the mbuf and return an error.
Also, when the IP Control Protocol is brought up it
SIOCSIFDSTADDRs+SIOCSIFADDRs the received ip addresses.

3) A Down() (or whatever might cause it) will bring us back to 1)

Do you think this will work?

Waldemar


Other related posts: