| 66 | } |
| 67 | |
| 68 | func (e *SynProxy) marshalData(fam byte) ([]byte, error) { |
| 69 | var flags uint32 |
| 70 | if e.Mss != 0 || e.MssValueSet { |
| 71 | flags |= NF_SYNPROXY_OPT_MSS |
| 72 | } |
| 73 | if e.Wscale != 0 || e.WscaleValueSet { |
| 74 | flags |= NF_SYNPROXY_OPT_WSCALE |
| 75 | } |
| 76 | if e.SackPerm { |
| 77 | flags |= NF_SYNPROXY_OPT_SACK_PERM |
| 78 | } |
| 79 | if e.Timestamp { |
| 80 | flags |= NF_SYNPROXY_OPT_TIMESTAMP |
| 81 | } |
| 82 | if e.Ecn { |
| 83 | flags |= NF_SYNPROXY_OPT_ECN |
| 84 | } |
| 85 | attrs := []netlink.Attribute{ |
| 86 | {Type: NFTA_SYNPROXY_MSS, Data: binaryutil.BigEndian.PutUint16(e.Mss)}, |
| 87 | {Type: NFTA_SYNPROXY_WSCALE, Data: []byte{e.Wscale}}, |
| 88 | {Type: NFTA_SYNPROXY_FLAGS, Data: binaryutil.BigEndian.PutUint32(flags)}, |
| 89 | } |
| 90 | return netlink.MarshalAttributes(attrs) |
| 91 | } |
| 92 | |
| 93 | func (e *SynProxy) unmarshal(fam byte, data []byte) error { |
| 94 | ad, err := netlink.NewAttributeDecoder(data) |