mirror of
https://github.com/soypat/lneto.git
synced 2026-08-19 22:24:03 +00:00
HTTP server example and DHCP Server rewrite (#38)
* improvements to dhcpv4 server * begin adding examples/httpserver * add better VLAN tagging methods * pcap: add error printing; fix bug in CRC * ipv4: ToS and Flags construction and flag manipulation improvements * add dhcp interception to httptap and improve httpserver example
This commit is contained in:
@@ -244,10 +244,12 @@ func (pc *PacketBreakdown) CaptureIPv4(dst []Frame, pkt []byte, bitOffset int) (
|
||||
println("BAD UDP")
|
||||
return dst, pc.vld.ErrPop()
|
||||
}
|
||||
frameLen := ufrm.Length()
|
||||
ifrm4.CRCWriteUDPPseudo(&crc, frameLen)
|
||||
if crc.PayloadSum16(ufrm.RawData()[:frameLen]) != 0 {
|
||||
protoErrs = append(protoErrs, lneto.ErrBadCRC)
|
||||
if ufrm.CRC() != 0 {
|
||||
frameLen := ufrm.Length()
|
||||
ifrm4.CRCWriteUDPPseudo(&crc, frameLen)
|
||||
if crc.PayloadSum16(ufrm.RawData()[:frameLen]) != 0 {
|
||||
protoErrs = append(protoErrs, lneto.ErrBadCRC)
|
||||
}
|
||||
}
|
||||
}
|
||||
case lneto.IPProtoICMP:
|
||||
|
||||
@@ -80,6 +80,16 @@ func (f *Formatter) FormatFrame(dst []byte, frm Frame, pkt []byte) (_ []byte, er
|
||||
return dst, err
|
||||
}
|
||||
}
|
||||
if len(frm.Errors) > 0 {
|
||||
dst = append(dst, " errs=("...)
|
||||
for i, err := range frm.Errors {
|
||||
if i != 0 {
|
||||
dst = append(dst, ';')
|
||||
}
|
||||
dst = append(dst, err.Error()...)
|
||||
}
|
||||
dst = append(dst, ')')
|
||||
}
|
||||
return dst, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user