Fixes #806 by padding out TCP options with NOPs.
Note, users still must be careful to not set more than 40 bytes of options, and users still have no way of setting one-byte options (namely, NOP (0x01) and EOL (0x00). git-svn-id: file:///home/svn/framework3/trunk@8348 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
2cbd6d152d
commit
8e6e4f8e44
|
@ -72,12 +72,15 @@ class TCP < RacketPart
|
|||
# Add an TCP option to this TCP object.
|
||||
# All rejiggering will happen when the call to fix!
|
||||
# happens automagically.
|
||||
# If the result is not on a 32-bit boundry, pad with NOPs.
|
||||
def add_option(number, value)
|
||||
t = Racket::Misc::TLV.new(1,1)
|
||||
t.type = number
|
||||
t.value = value
|
||||
t.length = value.length + 2
|
||||
@options << t.encode
|
||||
opts = t.encode
|
||||
opts += ("\x01" * (4-(opts.size % 4))) if (opts.size % 4) != 0
|
||||
@options << opts
|
||||
end
|
||||
|
||||
# Check the checksum for this TCP packet
|
||||
|
|
Loading…
Reference in New Issue