mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 09:51:56 +08:00
net/sockopt: move BINDTODEVICE to socket level
rename the UDP_BINDTODEVICE to SO_BINDTODEVICE to follow the linux style to be compatible with non-UDP protocol binding requirements Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
@@ -50,7 +50,6 @@
|
||||
#define IFF_UP (1 << 1) /* Interface is up */
|
||||
#define IFF_RUNNING (1 << 2) /* Carrier is available */
|
||||
#define IFF_IPv6 (1 << 3) /* Configured for IPv6 packet (vs ARP or IPv4) */
|
||||
#define IFF_BOUND (1 << 4) /* Bound to a socket */
|
||||
#define IFF_LOOPBACK (1 << 5) /* Is a loopback net */
|
||||
#define IFF_POINTOPOINT (1 << 6) /* Is point-to-point link */
|
||||
#define IFF_NOARP (1 << 7) /* ARP is not required for this packet */
|
||||
@@ -61,7 +60,6 @@
|
||||
|
||||
#define IFF_SET_UP(f) do { (f) |= IFF_UP; } while (0)
|
||||
#define IFF_SET_RUNNING(f) do { (f) |= IFF_RUNNING; } while (0)
|
||||
#define IFF_SET_BOUND(f) do { (f) |= IFF_BOUND; } while (0)
|
||||
#define IFF_SET_NOARP(f) do { (f) |= IFF_NOARP; } while (0)
|
||||
#define IFF_SET_LOOPBACK(f) do { (f) |= IFF_LOOPBACK; } while (0)
|
||||
#define IFF_SET_POINTOPOINT(f) do { (f) |= IFF_POINTOPOINT; } while (0)
|
||||
@@ -70,7 +68,6 @@
|
||||
|
||||
#define IFF_CLR_UP(f) do { (f) &= ~IFF_UP; } while (0)
|
||||
#define IFF_CLR_RUNNING(f) do { (f) &= ~IFF_RUNNING; } while (0)
|
||||
#define IFF_CLR_BOUND(f) do { (f) &= ~IFF_BOUND; } while (0)
|
||||
#define IFF_CLR_NOARP(f) do { (f) &= ~IFF_NOARP; } while (0)
|
||||
#define IFF_CLR_LOOPBACK(f) do { (f) &= ~IFF_LOOPBACK; } while (0)
|
||||
#define IFF_CLR_POINTOPOINT(f) do { (f) &= ~IFF_POINTOPOINT; } while (0)
|
||||
@@ -79,7 +76,6 @@
|
||||
|
||||
#define IFF_IS_UP(f) (((f) & IFF_UP) != 0)
|
||||
#define IFF_IS_RUNNING(f) (((f) & IFF_RUNNING) != 0)
|
||||
#define IFF_IS_BOUND(f) (((f) & IFF_BOUND) != 0)
|
||||
#define IFF_IS_NOARP(f) (((f) & IFF_NOARP) != 0)
|
||||
#define IFF_IS_LOOPBACK(f) (((f) & IFF_LOOPBACK) != 0)
|
||||
#define IFF_IS_POINTOPOINT(f) (((f) & IFF_POINTOPOINT) != 0)
|
||||
|
||||
@@ -31,10 +31,4 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* UDP protocol (SOL_UDP) socket options */
|
||||
|
||||
#define UDP_BINDTODEVICE (__SO_PROTOCOL + 0) /* Bind this UDP socket to a
|
||||
* specific network device.
|
||||
*/
|
||||
|
||||
#endif /* __INCLUDE_NETINET_UDP_H */
|
||||
|
||||
@@ -246,6 +246,10 @@ struct socket_conn_s
|
||||
#ifdef CONFIG_NET_TIMESTAMP
|
||||
int32_t s_timestamp; /* Socket timestamp enabled/disabled */
|
||||
#endif
|
||||
#ifdef CONFIG_NET_BINDTODEVICE
|
||||
uint8_t s_boundto; /* Index of the interface we are bound to.
|
||||
* Unbound: 0, Bound: 1-MAX_IFINDEX */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Connection-specific content may follow */
|
||||
|
||||
@@ -200,6 +200,8 @@
|
||||
#define SO_TIMESTAMP 16 /* Generates a timestamp for each incoming packet
|
||||
* arg: integer value
|
||||
*/
|
||||
#define SO_BINDTODEVICE 17 /* Bind this socket to a specific network device.
|
||||
*/
|
||||
|
||||
/* The options are unsupported but included for compatibility
|
||||
* and portability
|
||||
|
||||
Reference in New Issue
Block a user