Q: Set size of FieldLenField I want a 1 byte FieldLenField to allow only 256 items in the corresponding FieldListField, how can I do it ?
from scapy import *

class Foo(Packet):
    name = "Foo"
    fields_desc = [
        ShortField("id", random.getrandbits(16)),
        FieldLenField("len", None, count_of="pld"),
        FieldListField("pld", None, IPField("", "0.0.0.0"), count_from=lambda pkt: pkt.len)
    ]

Thank you for your help.

A: Setting FieldLenField to 1 byte
You need to override the default length for FieldLenField, which is currently H. H is a format character from Python's struct library, which is an unsigned 2 bytes (0-65535). To force one-byte unsigned, use B instead:
from scapy import *

class Foo(Packet):
    name = "Foo"
    fields_desc = [
        ShortField("id", random.getrandbits(16)),
        FieldLenField("len", 0, fmt="B", count_of="pld"),
        FieldListField("pld", None, IPField("", "0.0.0.0"), 
                       count_from=lambda pkt: pkt.len)
    ]

pkt = Foo()
print(bytes(pkt))

Running this, we'll get 2 random bytes for the ID and 1 byte for len, which looks like this: 
b'\x21\xea\x00'
where the last byte is the default 0 we've set.
Verification
If instead we try to set the value of len to 300, which is outside the interval [0, 255], we'll get an error:
pkt.len = 300
bytes(pkt)

...<traceback>
error: ubyte format requires 0 <= number <= 255

