File tree Expand file tree Collapse file tree 3 files changed +2
-29
lines changed
Expand file tree Collapse file tree 3 files changed +2
-29
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 77 "unsafe"
88
99 "github.com/tailscale/wireguard-go/conn"
10- "github.com/tailscale/wireguard-go/endian"
1110 "golang.org/x/sys/unix"
1211)
1312
@@ -50,25 +49,15 @@ func (v *virtioNetHdr) decode(b []byte) error {
5049 if len (b ) < virtioNetHdrLen {
5150 return errors .New ("too short" )
5251 }
53- v .flags = b [0 ]
54- v .gsoType = b [1 ]
55- v .hdrLen = endian .Native .Uint16 (b [2 :])
56- v .gsoSize = endian .Native .Uint16 (b [4 :])
57- v .csumStart = endian .Native .Uint16 (b [6 :])
58- v .csumOffset = endian .Native .Uint16 (b [8 :])
52+ copy (unsafe .Slice ((* byte )(unsafe .Pointer (v )), virtioNetHdrLen ), b [:virtioNetHdrLen ])
5953 return nil
6054}
6155
6256func (v * virtioNetHdr ) encode (b []byte ) error {
6357 if len (b ) < virtioNetHdrLen {
6458 return errors .New ("too short" )
6559 }
66- b [0 ] = v .flags
67- b [1 ] = v .gsoType
68- endian .Native .PutUint16 (b [2 :], v .hdrLen )
69- endian .Native .PutUint16 (b [4 :], v .gsoSize )
70- endian .Native .PutUint16 (b [6 :], v .csumStart )
71- endian .Native .PutUint16 (b [8 :], v .csumOffset )
60+ copy (b [:virtioNetHdrLen ], unsafe .Slice ((* byte )(unsafe .Pointer (v )), virtioNetHdrLen ))
7261 return nil
7362}
7463
You can’t perform that action at this time.
0 commit comments