static inline void _rmnet_netlink_get_link_ingress_data_format (struct rmnet_nl_msg_s *rmnet_header, struct rmnet_nl_msg_s *resp_rmnet) { struct net_device *dev; struct rmnet_phys_ep_conf_s *config; _RMNET_NETLINK_NULL_CHECKS(); resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNCODE; dev = dev_get_by_name(&init_net, rmnet_header->data_format.dev); if (!dev) { resp_rmnet->return_code = RMNET_CONFIG_NO_SUCH_DEVICE; return; } config = _rmnet_get_phys_ep_config(dev); if (!config) { resp_rmnet->return_code = RMNET_CONFIG_INVALID_REQUEST; return; } /* Begin Data */ resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNDATA; resp_rmnet->arg_length = RMNET_NL_MSG_SIZE(data_format); resp_rmnet->data_format.flags = config->ingress_data_format; }
static void _rmnet_netlink_set_logical_ep_config (struct rmnet_nl_msg_s *rmnet_header, struct rmnet_nl_msg_s *resp_rmnet) { struct net_device *dev, *dev2; _RMNET_NETLINK_NULL_CHECKS(); resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNCODE; if (rmnet_header->local_ep_config.ep_id < -1 || rmnet_header->local_ep_config.ep_id > 254) { resp_rmnet->return_code = RMNET_CONFIG_BAD_ARGUMENTS; return; } dev = dev_get_by_name(&init_net, rmnet_header->local_ep_config.dev); dev2 = dev_get_by_name(&init_net, rmnet_header->local_ep_config.next_dev); if (dev != 0 && dev2 != 0) resp_rmnet->return_code = rmnet_set_logical_endpoint_config( dev, rmnet_header->local_ep_config.ep_id, rmnet_header->local_ep_config.operating_mode, dev2); else resp_rmnet->return_code = RMNET_CONFIG_NO_SUCH_DEVICE; }
static void _rmnet_netlink_add_del_vnd_tc_flow (uint32_t command, struct rmnet_nl_msg_s *rmnet_header, struct rmnet_nl_msg_s *resp_rmnet) { uint32_t id; uint32_t map_flow_id; uint32_t tc_flow_id; _RMNET_NETLINK_NULL_CHECKS(); resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNCODE; id = rmnet_header->flow_control.id; map_flow_id = rmnet_header->flow_control.map_flow_id; tc_flow_id = rmnet_header->flow_control.tc_flow_id; switch (command) { case RMNET_NETLINK_ADD_VND_TC_FLOW: resp_rmnet->return_code = rmnet_vnd_add_tc_flow(id, map_flow_id, tc_flow_id); break; case RMNET_NETLINK_DEL_VND_TC_FLOW: resp_rmnet->return_code = rmnet_vnd_del_tc_flow(id, map_flow_id, tc_flow_id); break; default: LOGM("Called with unhandled command %d", command); resp_rmnet->return_code = RMNET_CONFIG_INVALID_REQUEST; break; } }
static void _rmnet_netlink_unset_logical_ep_config (struct rmnet_nl_msg_s *rmnet_header, struct rmnet_nl_msg_s *resp_rmnet) { struct net_device *dev; _RMNET_NETLINK_NULL_CHECKS(); resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNCODE; if (rmnet_header->local_ep_config.ep_id < -1 || rmnet_header->local_ep_config.ep_id > 254) { resp_rmnet->return_code = RMNET_CONFIG_BAD_ARGUMENTS; return; } dev = dev_get_by_name(&init_net, rmnet_header->local_ep_config.dev); if (dev) { resp_rmnet->return_code = rmnet_unset_logical_endpoint_config( dev, rmnet_header->local_ep_config.ep_id); dev_put(dev); } else { resp_rmnet->return_code = RMNET_CONFIG_NO_SUCH_DEVICE; } }
static void _rmnet_netlink_unassociate_network_device (struct rmnet_nl_msg_s *rmnet_header, struct rmnet_nl_msg_s *resp_rmnet) { struct net_device *dev; _RMNET_NETLINK_NULL_CHECKS(); resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNCODE; dev = dev_get_by_name(&init_net, rmnet_header->data); if (!dev) { resp_rmnet->return_code = RMNET_CONFIG_NO_SUCH_DEVICE; return; } resp_rmnet->return_code = rmnet_unassociate_network_device(dev); }
static void _rmnet_netlink_set_link_ingress_data_format (struct rmnet_nl_msg_s *rmnet_header, struct rmnet_nl_msg_s *resp_rmnet) { struct net_device *dev; _RMNET_NETLINK_NULL_CHECKS(); resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNCODE; dev = dev_get_by_name(&init_net, rmnet_header->data_format.dev); if (!dev) { resp_rmnet->return_code = RMNET_CONFIG_NO_SUCH_DEVICE; return; } resp_rmnet->return_code = rmnet_set_ingress_data_format(dev, rmnet_header->data_format.flags); }
static void _rmnet_netlink_get_vnd_name (struct rmnet_nl_msg_s *rmnet_header, struct rmnet_nl_msg_s *resp_rmnet) { int r; _RMNET_NETLINK_NULL_CHECKS(); resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNCODE; r = rmnet_vnd_get_name(rmnet_header->vnd.id, resp_rmnet->vnd.vnd_name, RMNET_MAX_STR_LEN); if (r != 0) { resp_rmnet->return_code = RMNET_CONFIG_INVALID_REQUEST; return; } /* Begin Data */ resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNDATA; resp_rmnet->arg_length = RMNET_NL_MSG_SIZE(vnd); }
static void _rmnet_netlink_get_logical_ep_config (struct rmnet_nl_msg_s *rmnet_header, struct rmnet_nl_msg_s *resp_rmnet) { struct net_device *dev; _RMNET_NETLINK_NULL_CHECKS(); resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNCODE; if (rmnet_header->local_ep_config.ep_id < -1 || rmnet_header->local_ep_config.ep_id > 254) { resp_rmnet->return_code = RMNET_CONFIG_BAD_ARGUMENTS; return; } dev = dev_get_by_name(&init_net, rmnet_header->local_ep_config.dev); if (dev) resp_rmnet->return_code = rmnet_get_logical_endpoint_config( dev, rmnet_header->local_ep_config.ep_id, &resp_rmnet->local_ep_config.operating_mode, resp_rmnet->local_ep_config.next_dev, sizeof(resp_rmnet->local_ep_config.next_dev)); else { resp_rmnet->return_code = RMNET_CONFIG_NO_SUCH_DEVICE; return; } if (resp_rmnet->return_code == RMNET_CONFIG_OK) { /* Begin Data */ resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNDATA; resp_rmnet->arg_length = RMNET_NL_MSG_SIZE(local_ep_config); } dev_put(dev); }