On Mar 27, Matthias Drochner wrote
> Excerpts from netbsd: 24-Mar-98 NetBSD master CVS tree commits The S. of
> A. Evil@netbsd (240)
>
> > Modified Files:
> > if_atmsubr.c
> > Log Message:
> > Add a missing ntohs. With this change I got ip over atm (vpi/vci) working
> > between 2 PCs.
>
> This looks wrong - or at least it is not as it was planned to work.
> The ATM_LLC_TYPE() macro does already the byte swap.
> (look at the changes for r1.8 and r1.9)
> Perhaps there is something wrong at the sender's side?
> (Can't test it now, but IP via encapsulation used to work for
> me prevoiusly, even to different boxes (Sun/FORE and DEC)).
Ok, some more details here:
[note: this is from 1.3_ALPHA sources - it's all what I have under hands
for now]
from if_atm.h:
#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1]))
#define ATM_LLC_SETTYPE(X,V) { \
(X)->type[0] = ((V) >> 8) & 0xff; \
(X)->type[1] = ((V) & 0xff); \
}
So these macros takes or return type value in host byte order.
Now from if_atmsubr.c: in atm_output(), we have:
etype = htons(ETHERTYPE_IP);
and thenm later etype is feed to ATM_LLC_SETTYPE:
bcopy(ATMLLC_HDR, atmllc->llchdr,
sizeof(atmllc->llchdr));
ATM_LLC_SETTYPE(atmllc, etype);
/* note: already in network order */
There is something wrong here. Now this may have been corrected
in -current. I'm sure this was not correct in 1.3 too, as IP over ATM
didn't work without my (wrong) patch.
--
Manuel Bouyer, Ecole Nationale Superieure de Techniques Avancees, Paris
email: bouyer@ensta.fr
--