xiaoxiang781216 commented on code in PR #3876: URL: https://github.com/apache/nuttx-apps/pull/3876#discussion_r4308642100
########## netutils/wifibridge/Kconfig: ########## @@ -0,0 +1,32 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config NETUTILS_WIFIBRIDGE + bool "Wi-Fi SoftAP to Ethernet bridge" + default n + depends on NET_IPv4 && NET_BRIDGE && WIRELESS_WAPI + select NETUTILS_NETLIB Review Comment: depend on ? ########## netutils/wifibridge/wifibridge.c: ########## @@ -0,0 +1,378 @@ +/**************************************************************************** + * apps/netutils/wifibridge/wifibridge.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <sys/ioctl.h> +#include <sys/socket.h> + +#include <errno.h> +#include <string.h> +#include <unistd.h> + +#include <net/if.h> +#include <arpa/inet.h> +#include <netinet/in.h> + +#include <nuttx/net/ioctl.h> + +#include "netutils/netlib.h" +#include "netutils/wifibridge.h" +#include "wireless/wapi.h" + +#ifdef CONFIG_NETUTILS_WIFIBRIDGE_DHCPD +# include "netutils/dhcpd.h" +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: wifibridge_ifcmd + * + * Description: + * Add or remove a bridge port. + * + ****************************************************************************/ + +static int wifibridge_ifcmd(int sock, int cmd, FAR const char *bridge, + FAR const char *ifname) +{ + struct ifreq req; + + memset(&req, 0, sizeof(req)); + strlcpy(req.ifr_name, bridge, IFNAMSIZ); + req.ifr_ifindex = if_nametoindex(ifname); + if (req.ifr_ifindex == 0) + { + return -ENODEV; Review Comment: -errno ########## system/wifibridge/README.md: ########## @@ -0,0 +1,44 @@ +# wifibridge + +Wi-Fi SoftAP to Ethernet bridge for NuttX. It turns a Wi-Fi interface Review Comment: move to nuttx/Documentation ########## netutils/wifibridge/wifibridge.c: ########## @@ -0,0 +1,378 @@ +/**************************************************************************** + * apps/netutils/wifibridge/wifibridge.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <sys/ioctl.h> +#include <sys/socket.h> + +#include <errno.h> +#include <string.h> +#include <unistd.h> + +#include <net/if.h> +#include <arpa/inet.h> +#include <netinet/in.h> + +#include <nuttx/net/ioctl.h> + +#include "netutils/netlib.h" +#include "netutils/wifibridge.h" +#include "wireless/wapi.h" + +#ifdef CONFIG_NETUTILS_WIFIBRIDGE_DHCPD +# include "netutils/dhcpd.h" +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: wifibridge_ifcmd + * + * Description: + * Add or remove a bridge port. + * + ****************************************************************************/ + +static int wifibridge_ifcmd(int sock, int cmd, FAR const char *bridge, Review Comment: should we add the common bridge to netlib? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
