the link level name for the interface (ifp->if_sadl) is allocated
before ifp->if_addrlen is initialized, which could lead to allocating
too little space for the link level address.
Do this by splitting allocation of the link level name out of
if_attach() and into if_alloc_sadl(), which is normally called
by functions like ether_ifattach(). Network interfaces which
don't have a link-specific attach routine must call if_alloc_sadl()
themselves (example: gif).
Link level names are freed by if_free_sadl(), which can be called
from e.g. ether_ifdetach(). Drivers never need call if_free_sadl()
themselves as if_detach() will do it if it is not already done.
While here, add the ability to pass an AF_LINK address to
SIOCSIFADDR in ether_ioctl() (this is what caused me to notice
the problem that the above fixes).
Defer output processing to the software interrupt.
Note, that in the process of doing this, I discovered several
very broken things about this driver, which are not fixed with
this commit. It should work as well as it previously did, but
this code could be seriously improved. As soon as I can find
my second Metricom radio, I'll give it a proper shakedown.
Once we have a complete frame, schedule a STRIP software interrupt,
and manipulate ipintrq from there. This will allow us to clean up
the use of splimp() in this file later.
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.
The old timeout()/untimeout() API has been removed from the kernel.
stripclose(). In strip_watchdog(), make abort if the line has been closed.
This fixes kern/4470 (Wolfgang Rupprecht), which was a bad pointer passed
to b_to_q() from strip_proberadio() called via strip_watchdog(); the tty
hadn't yet been attached to the strip interface.
* Fix radio error-message parsing bug: old comparison against error
prefix string off by the size of the Starmode link-level protocol field.
* Fix radio reset finite state machine, given that parsing works properly.
* Add debugging messages about reset FSM if IFF_DEBUG is set.
* Remove #ifdefs notdef around back the check that discards newlines at
the beginning of a frame. Every error message from the radio has a newline,
as the radio send error messages terminated by \r\n, not just \r like data
frames. Not dropping the \n garbles the following data frame.
* Remove unused low-level debugging routines.
* Reformat the low-level bytestuff/RLL code to match the canonical source.
* Reduce MTU to 1100 bytes; 1200 bytes can overflow the radio buffers if the
bytestuff/RLL does poorly.
* Fix radio-probe string to _not_ include a frame delimiter (\r): sending
a \r to the radio tickles a bug in the firmware, causing the radio to
smash the next frame sent after the "**\r" probe string.
* Add calls to the tty t_oproc routine to make sure the probe and reset
strings get sent to the modem promptly, rather than waiting for the next
packet.
* Add PPP-style calls to the tty start-output function; seems to
reduce latency marginally.
still to do:
* Flush output queue if resetting, since the radio is going to drop
frames on the floor anyway if it needs resetting.
* Reduce tty start-output calls.
somehow got lost between NetBSD and Linux. Output side mbuf-walking
code now correctly bytestuffs mbuf chains, as well as single mbufs
and clusters.
* Update radio error-parsing code to Stuart's latest stable code.
We now parse error messages the older code didn't.
* Note where radio-crash watchdogs should be added (the linux code
is there, #ifdef'ed out). This still just doesn't work.
The radio reset doesn't always work even when slattatch is first started,
but I have a radio with old firmware, which may be a contributing factor.
* Correct the checks for the tty output queue being overfull; estimate
the stuffed pkt size as (original * 65/64) + STRIP_HDRLEN + 2,
instead of SLIP's (2*SLMTU). Re-enable the disabled check now the
size estimate isn't excessively large.
* Fix BPF tapping of strip interfaces, STRIP packets are wrapped
in a SLIP bpf header. This implies no BPF support for arp or atalk,
even though Linux boxes are sending arp requests and gratuitous arps.
There may be no good fix short of adding explicit STRIP encapsulation
support to bpf/tcpdump.
* Still need a solid walkthrough, and rewrite to eliminate redundant
receive-side mbuf copying.