From: ben@datacomm.ucc.okstate.edu (Ben James)
Subject: Oditrpkt ( One last Problem! )
Organization: Oklahoma State University, Stillwater, OK
Date: Wed, 18 Nov 1992 04:11:41 GMT


I am still haveing problems with oditrpkt.com.  At the moment I have almost

everything working.  My current problem is that my driver or ODI is changeing

my offset in TCP this is this field which tells where exactly the data 

starts.  For some reason every time I send a TCP packet out threw my driver and 

odi this offset is set to 5.  Unfortunitally the first packet has an options 

field giving the maximum segment size so this field should be 6.  I have been 

able to get a telnet session open too our 3Com Token-Ring Bridge's.  Also once 

by some glitch it worked ok.  I do know that this field is correct when it goes

into my driver so somehow it is getting changed.  It appears to me that this 

is being changed by the LSL or MLID but is always eaiser to place the blame 

somewhere else.  Everything else is working perfectly I even have route.com 

doing the source routing for me.  


A brief description of what I do

First I get the type field and move it to the Stack ID and also the ProtocolID

fields in the ECB then I move the dest address to the immediate address of the

ECB if its arp I change the hardware field and also reduce size.  Then I move

the pointer to where the data begins.
 
Below is a copy of the send routine sECB is a pointer to the beginning of
the Event Control Block.  I have also marked the portion which differs from 
odipkt.com which consists of code to alter the mac header.  

This code is copyrighted by Daniel D. Lanciani and the complete copyright
message is given in the odipkt.asm source file.  That message also applies
to here.  ( Just to be safe )

	;	This part is done at initialization.  
 ; 	Initialization for sECB is the same as for odipkt execpt no raw send
	mov     word ptr sECB + 10, offset transcom    ; Call Transcom 
	mov     word ptr sECB + 12, cs                 ; Also ptr to transcom
	;	mov     word ptr sECB + 14, -1                 ; stack ID
	mov     ax, board                              ; Board #
	mov     word ptr sECB + 22, ax                 ; Board # 
	mov     word ptr sECB + 44, 1                  ; Fragment0Count

send_pkt:sti
	push    ds
	mov     bx, ds
	mov     dx, cs
	mov     ds, dx
send_pkt1:
	cmp   word ptr 8 + sECB, 0        ; status clear ?
	jg      send_pkt1		  ; If not wait until it is.

	add     stab + 4, 1               ; Stistics for Pktdrvr
	adc     stab + 6, 0
	add     stab + 12, cx
	adc     stab + 14, 0		  ; End stats

	mov     word ptr sECB + 48, bx          ; Fragment0address LW
	
;*********Here is where my code and odipkt differ.*********
	; They would be the same if you took out this.

	push    cx
	mov     es, bx
	; Move type into ECB fields
	mov     cx, word ptr es:12[si]		; Get type field from packet.
	mov     word ptr sECB + 14, cx          ; StackID        
	mov     word ptr sECB + 20, cx          ; ProtocolID
	
	mov     cx, word ptr es:0[si]
	mov     word ptr sECB + 24, cx          ; Immediate address
	mov     cx, word ptr es:2[si]
	mov     word ptr sECB + 26, cx
	mov     cx, word ptr es:4[si]
	mov     word ptr sECB + 28, cx          ; *****************
	pop     cx
	cmp     word ptr es:12[si], 0608h       
	jnz     not_arp_send                    ; if not arp then jump
	mov     byte ptr es:15[si], 06h         ; is arp
	sub     cx, 18                          ; Reduce size for arp

not_arp_send:        

	add     si, 14	 	Offset stack pointer by 
				send and recieve address + AC + FC
	sub     cx, 14		Offset size by the same.

;*********From here on it is the same as odipkt.********

send_pkt4:
	mov     word ptr sECB + 42, cx           ; Data Length
	mov     word ptr sECB + 46, si           ; Fragment0Address
	mov     word ptr sECB + 50, cx           ; Fragment0Legnth
	mov     si, offset sECB
	mov     es, dx
	mov     bx, 12                           ; Send Packet
	call    psup
	sti

send_pkt2:
	cmp   word ptr 8 + sECB, 0              ; Status 
	jg      send_pkt2			; loop until clear or fail
	jnz     send_pkt3
	pop     ds
	jmp     good

send_pkt3:
	add   stab + 20, 1                     ; Stats
	adc     stab + 22, 0
	pop     ds
	mov     dh, 12
	jmp     bad

Xref: sparky comp.dcom.lans:1975 comp.dcom.lans.ethernet:2497 comp.dcom.sys.cisco:1633