Since you don't specify otherwise, you are using the native representation for your long
s. Try adding the =
specifier (native byte order, standard size):
struct.pack("=H??LLLLH",
socket.ntohs(v1),
v2,
v3,
socket.ntohl(v5),
socket.ntohl(v6),
socket.ntohl(v7),
socket.ntohl(v8),
socket.ntohs(v9))
References: