Lines Matching defs:sock
39 #include <net/sock.h>
75 struct socket *sock;
476 static void set_mcast_loop(struct sock *sk, u_char loop)
480 /* setsockopt(sock, SOL_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop)); */
489 static void set_mcast_ttl(struct sock *sk, u_char ttl)
493 /* setsockopt(sock, SOL_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)); */
502 static int set_mcast_if(struct sock *sk, char *ifname)
562 join_mcast_group(struct sock *sk, struct in_addr *addr, char *ifname)
586 static int bind_mcastif_addr(struct socket *sock, char *ifname)
608 return sock->ops->bind(sock, (struct sockaddr*)&sin, sizeof(sin));
616 struct socket *sock;
620 result = sock_create_kern(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock);
626 result = set_mcast_if(sock->sk, ip_vs_master_mcast_ifn);
632 set_mcast_loop(sock->sk, 0);
633 set_mcast_ttl(sock->sk, 1);
635 result = bind_mcastif_addr(sock, ip_vs_master_mcast_ifn);
641 result = sock->ops->connect(sock, (struct sockaddr *) &mcast_addr,
648 return sock;
651 sock_release(sock);
661 struct socket *sock;
665 result = sock_create_kern(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock);
672 sock->sk->sk_reuse = 1;
674 result = sock->ops->bind(sock, (struct sockaddr *) &mcast_addr,
682 result = join_mcast_group(sock->sk,
690 return sock;
693 sock_release(sock);
699 ip_vs_send_async(struct socket *sock, const char *buffer, const size_t length)
709 len = kernel_sendmsg(sock, &msg, &iov, 1, (size_t)(length));
716 ip_vs_send_sync_msg(struct socket *sock, struct ip_vs_sync_mesg *msg)
725 if (ip_vs_send_async(sock, (char *)msg, msize) != msize)
730 ip_vs_receive(struct socket *sock, char *buffer, const size_t buflen)
742 len = kernel_recvmsg(sock, &msg, &iov, 1, buflen, 0);
763 ip_vs_send_sync_msg(tinfo->sock, sb->mesg);
770 ip_vs_send_sync_msg(tinfo->sock, sb->mesg);
788 sock_release(tinfo->sock);
805 wait_event_interruptible(*sk_sleep(tinfo->sock->sk),
806 !skb_queue_empty(&tinfo->sock->sk->sk_receive_queue)
810 while (!skb_queue_empty(&(tinfo->sock->sk->sk_receive_queue))) {
811 len = ip_vs_receive(tinfo->sock, tinfo->buf,
827 sock_release(tinfo->sock);
839 struct socket *sock;
858 sock = make_send_sock();
869 sock = make_receive_sock();
874 if (IS_ERR(sock)) {
875 result = PTR_ERR(sock);
890 tinfo->sock = sock;
913 sock_release(sock);