+/*
+ * check if address is covered by socket
+ *
+ * sk: the socket to check against
+ * addr: the address in question (must be != 0)
+ */
+static inline int __addr_in_socket(struct sock *sk, uint32_t addr)
+{
+ struct nx_info *nxi = sk->sk_nx_info;
+ uint32_t saddr = tcp_v4_rcv_saddr(sk);
+
+ vxdprintk(VXD_CBIT(net, 5),
+ "__addr_in_socket(%p,%d.%d.%d.%d) %p:%d.%d.%d.%d %p;%lx",
+ sk, VXD_QUAD(addr), nxi, VXD_QUAD(saddr), sk->sk_socket,
+ (sk->sk_socket?sk->sk_socket->flags:0));
+
+ if (saddr) {
+ /* direct address match */
+ return (saddr == addr);
+ } else if (nxi) {
+ /* match against nx_info */
+ return addr_in_nx_info(nxi, addr);
+ } else {
+ /* unrestricted any socket */
+ return 1;
+ }
+}