MCPcopy Create free account
hub / github.com/google/nftables / parseSetDatatype

Function parseSetDatatype

set.go:820–838  ·  view source on GitHub ↗
(magic uint32)

Source from the content-addressed store, hash-verified

818}
819
820func parseSetDatatype(magic uint32) (SetDatatype, error) {
821 types := make([]SetDatatype, 0, 32/SetConcatTypeBits)
822 for magic != 0 {
823 t := magic & SetConcatTypeMask
824 magic = magic >> SetConcatTypeBits
825 dt, ok := nftDatatypesByMagic[t]
826 if !ok {
827 return TypeInvalid, fmt.Errorf("could not determine data type %+v", dt)
828 }
829 // Because we start with the last type, we insert the later types at the front.
830 types = append([]SetDatatype{dt}, types...)
831 }
832
833 dt, err := ConcatSetType(types...)
834 if err != nil {
835 return TypeInvalid, fmt.Errorf("could not create data type: %w", err)
836 }
837 return dt, nil
838}
839
840var (
841 newElemHeaderType = netlink.HeaderType((unix.NFNL_SUBSYS_NFTABLES << 8) | unix.NFT_MSG_NEWSETELEM)

Callers 2

setsFromMsgFunction · 0.85
TestParseSetDatatypeFunction · 0.85

Calls 1

ConcatSetTypeFunction · 0.85

Tested by 1

TestParseSetDatatypeFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…