Lines Matching +full:recv +full:- +full:not +full:- +full:empty
1 # SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
99 'binary', 'string', 'nul-string',
100 'nested', 'nested-array',
106 self.error = -nl_msg.error
141 return format.big if byte_order == "big-endian" \
151 raise Exception(f"Auto-scalar len payload be 4 or 8 bytes, got {len(self.raw)}")
157 return self.raw.decode('ascii')[:-1]
221 self.extack['miss-type'] = extack.as_scalar('u32')
223 self.extack['miss-nest'] = extack.as_scalar('u32')
225 self.extack['bad-attr-offs'] = extack.as_scalar('u32')
229 if 'unknown' not in self.extack:
235 if 'miss-type' in self.extack and 'miss-nest' not in self.extack:
236 miss_type = self.extack['miss-type']
239 self.extack['miss-type'] = spec['name']
241 self.extack['miss-type-doc'] = spec['doc']
250 policy['min-value'] = attr.as_scalar('s64')
252 policy['max-value'] = attr.as_scalar('s64')
254 policy['min-value'] = attr.as_scalar('u64')
256 policy['max-value'] = attr.as_scalar('u64')
258 policy['min-length'] = attr.as_scalar('u32')
260 policy['max-length'] = attr.as_scalar('u32')
262 policy['bitfield32-mask'] = attr.as_scalar('u32')
324 reply = sock.recv(128 * 1024)
352 if mcast_name and mcast_id is not None:
401 if mcast_name not in mcast_groups:
402 raise Exception(f'Multicast group "{mcast_name}" not present in the spec')
429 if mcast_name not in self.genl_family['mcast']:
430 raise Exception(f'Multicast group "{mcast_name}" not present in the family')
453 raise Exception(f"Attribute '{name}' not defined in any attribute-set")
470 if self.proto == "netlink-raw":
476 raise Exception(f"Family '{self.yaml['name']}' not supported by the kernel")
480 # the first dump recv() on the socket, our setting will only matter
481 # from the second recv() on.
483 # Netlink will always allocate at least PAGE_SIZE - sizeof(skb_shinfo)
516 if not self._recv_dbg:
518 print("Recv: read", len(reply), "bytes,",
525 if enum.type == 'flags' or attr_spec.get('enum-as-flags', False):
561 sub_space = attr['nested-attributes']
566 if not value:
596 elif attr['type'] == 'sub-message':
609 raise Exception(f"Unknown attribute-set '{msg_format.attr_set}'")
613 pad = b'\x00' * ((4 - len(attr_payload) % 4) % 4)
618 if enum.type == 'flags' or attr_spec.get('enum-as-flags', False):
653 if attr_spec["sub-type"] == 'nest':
654 subattrs = self._decode(NlAttrs(item.raw), attr_spec['nested-attributes'])
656 elif attr_spec["sub-type"] == 'binary':
661 elif attr_spec["sub-type"] in NlAttr.type_formats:
662 subattr = item.as_scalar(attr_spec['sub-type'], attr_spec.byte_order)
669 raise Exception(f'Unknown {attr_spec["sub-type"]} with name {attr_spec["name"]}')
675 for name in attr_spec['type-value']:
678 subattrs = self._decode(NlAttrs(value.raw), attr_spec['nested-attributes'])
690 if name in rsp and type(rsp[name]) is not list:
696 if not is_multi:
705 if sub_msg not in self.sub_msgs:
706 raise Exception(f"No sub-message spec named {sub_msg} for {attr_spec.name}")
711 if value not in sub_msg_spec.formats:
712 raise Exception(f"No message format for '{value}' in sub-message spec '{sub_msg}'")
729 … raise Exception(f"Unknown attribute-set '{attr_space}' when decoding '{attr_spec.name}'")
742 if not self.process_unknown:
750 … subdict = self._decode(NlAttrs(attr.raw), attr_spec['nested-attributes'], search_attrs)
766 elif attr_spec["type"] == 'indexed-array':
774 elif attr_spec["type"] == 'sub-message':
776 elif attr_spec["type"] == 'nest-type-value':
779 if not self.process_unknown:
808 self.attr_sets[attr_spec['nested-attributes']],
817 if 'bad-attr-offs' not in extack:
823 extack['bad-attr-offs'])
825 del extack['bad-attr-offs']
826 extack['bad-attr'] = path
866 if value is not None:
922 raise Exception(f"Display hint '{attr_spec.display_hint}' not implemented"
942 reply = self.sock.recv(self._recv_size, socket.MSG_DONTWAIT)
950 print("Netlink error in ntf!?", os.strerror(-nl_msg.error))
958 if decoded.cmd() not in self.async_msg_ids:
972 except queue.Empty:
973 if duration is not None:
974 timeout = start_time + duration - time.time()
989 if not op:
1024 while not done:
1025 reply = self.sock.recv(self._recv_size)
1046 elif not op_rsp:
1061 if nl_msg.nl_seq not in reqs_by_seq or decoded.cmd() != op.rsp_value: