-
Notifications
You must be signed in to change notification settings - Fork 2
/
igmp.s
60 lines (55 loc) · 986 Bytes
/
igmp.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
;;; Internet Group Management Protocol
;;; version 1, maybe 2.
include "zombie.def"
.area .data
pgroup: .db 224,0,0,251 ; mdns test
.area .code
export igmp_in
igmp_in:
lda ,x ; is a query packet?
cmpa #$11
bne out@
leau 4,x
leay pgroup,pcr ; is our group?
lbsr ip_cmp
beq a@
ldd ,u
bne out@
ldd 2,u
bne out@
;; send our report
a@ lbsr igmp_test
out@ lbra ip_drop
;;; takes X = ptr to ip group no
export igmp_test
igmp_test:
ldd pgroup,pcr ; new IP dest ip to our group
std dipaddr,pcr
ldd pgroup+2,pcr
std dipaddr+2,pcr
;; build a unsolicited report message
lbsr getbuff
bcs err@
pshs x
leax 47,x ; leave room for lower layers
pshs x
ldd #$1600 ; type, time
std ,x++
ldd #$0000 ; check sum
std ,x++
ldd pgroup,pcr
std ,x++
ldd pgroup+2,pcr
std ,x
puls x ; calc and set cksum
ldd #0
ldy #8
lbsr ip_cksum
std 2,x
ldb #2 ; set ip protocol
stb proto,pcr
ldd #8 ; length of igmp packet
lbsr ip_out
puls x
lbsr freebuff
err@ rts