• Home
  • Raw
  • Download

Lines Matching refs:addr

78 static void sctp_v6_to_addr(union sctp_addr *addr, struct in6_addr *saddr,
93 struct sctp_sockaddr_entry *addr = NULL; in sctp_inet6addr_event() local
100 addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); in sctp_inet6addr_event()
101 if (addr) { in sctp_inet6addr_event()
102 addr->a.v6.sin6_family = AF_INET6; in sctp_inet6addr_event()
103 addr->a.v6.sin6_port = 0; in sctp_inet6addr_event()
104 addr->a.v6.sin6_addr = ifa->addr; in sctp_inet6addr_event()
105 addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex; in sctp_inet6addr_event()
106 addr->valid = 1; in sctp_inet6addr_event()
108 list_add_tail_rcu(&addr->list, &net->sctp.local_addr_list); in sctp_inet6addr_event()
109 sctp_addr_wq_mgmt(net, addr, SCTP_ADDR_NEW); in sctp_inet6addr_event()
115 list_for_each_entry_safe(addr, temp, in sctp_inet6addr_event()
117 if (addr->a.sa.sa_family == AF_INET6 && in sctp_inet6addr_event()
118 ipv6_addr_equal(&addr->a.v6.sin6_addr, in sctp_inet6addr_event()
119 &ifa->addr)) { in sctp_inet6addr_event()
120 sctp_addr_wq_mgmt(net, addr, SCTP_ADDR_DEL); in sctp_inet6addr_event()
122 addr->valid = 0; in sctp_inet6addr_event()
123 list_del_rcu(&addr->list); in sctp_inet6addr_event()
129 kfree_rcu(addr, rcu); in sctp_inet6addr_event()
353 pr_debug("rt6_dst:%pI6 rt6_src:%pI6\n", &rt->rt6i_dst.addr, in sctp_v6_get_dst()
395 struct sctp_sockaddr_entry *addr; in sctp_v6_copy_addrlist() local
406 addr = kzalloc(sizeof(*addr), GFP_ATOMIC); in sctp_v6_copy_addrlist()
407 if (addr) { in sctp_v6_copy_addrlist()
408 addr->a.v6.sin6_family = AF_INET6; in sctp_v6_copy_addrlist()
409 addr->a.v6.sin6_port = 0; in sctp_v6_copy_addrlist()
410 addr->a.v6.sin6_addr = ifp->addr; in sctp_v6_copy_addrlist()
411 addr->a.v6.sin6_scope_id = dev->ifindex; in sctp_v6_copy_addrlist()
412 addr->valid = 1; in sctp_v6_copy_addrlist()
413 INIT_LIST_HEAD(&addr->list); in sctp_v6_copy_addrlist()
414 list_add_tail(&addr->list, addrlist); in sctp_v6_copy_addrlist()
423 static void sctp_v6_from_skb(union sctp_addr *addr, struct sk_buff *skb, in sctp_v6_from_skb() argument
429 port = &addr->v6.sin6_port; in sctp_v6_from_skb()
430 addr->v6.sin6_family = AF_INET6; in sctp_v6_from_skb()
431 addr->v6.sin6_flowinfo = 0; /* FIXME */ in sctp_v6_from_skb()
432 addr->v6.sin6_scope_id = ((struct inet6_skb_parm *)skb->cb)->iif; in sctp_v6_from_skb()
437 addr->v6.sin6_addr = ipv6_hdr(skb)->saddr; in sctp_v6_from_skb()
440 addr->v6.sin6_addr = ipv6_hdr(skb)->daddr; in sctp_v6_from_skb()
445 static void sctp_v6_from_sk(union sctp_addr *addr, struct sock *sk) in sctp_v6_from_sk() argument
447 addr->v6.sin6_family = AF_INET6; in sctp_v6_from_sk()
448 addr->v6.sin6_port = 0; in sctp_v6_from_sk()
449 addr->v6.sin6_addr = sk->sk_v6_rcv_saddr; in sctp_v6_from_sk()
453 static void sctp_v6_to_sk_saddr(union sctp_addr *addr, struct sock *sk) in sctp_v6_to_sk_saddr() argument
455 if (addr->sa.sa_family == AF_INET) { in sctp_v6_to_sk_saddr()
460 addr->v4.sin_addr.s_addr; in sctp_v6_to_sk_saddr()
462 sk->sk_v6_rcv_saddr = addr->v6.sin6_addr; in sctp_v6_to_sk_saddr()
467 static void sctp_v6_to_sk_daddr(union sctp_addr *addr, struct sock *sk) in sctp_v6_to_sk_daddr() argument
469 if (addr->sa.sa_family == AF_INET) { in sctp_v6_to_sk_daddr()
473 sk->sk_v6_daddr.s6_addr32[3] = addr->v4.sin_addr.s_addr; in sctp_v6_to_sk_daddr()
475 sk->sk_v6_daddr = addr->v6.sin6_addr; in sctp_v6_to_sk_daddr()
480 static void sctp_v6_from_addr_param(union sctp_addr *addr, in sctp_v6_from_addr_param() argument
484 addr->v6.sin6_family = AF_INET6; in sctp_v6_from_addr_param()
485 addr->v6.sin6_port = port; in sctp_v6_from_addr_param()
486 addr->v6.sin6_flowinfo = 0; /* BUG */ in sctp_v6_from_addr_param()
487 addr->v6.sin6_addr = param->v6.addr; in sctp_v6_from_addr_param()
488 addr->v6.sin6_scope_id = iif; in sctp_v6_from_addr_param()
494 static int sctp_v6_to_addr_param(const union sctp_addr *addr, in sctp_v6_to_addr_param() argument
501 param->v6.addr = addr->v6.sin6_addr; in sctp_v6_to_addr_param()
507 static void sctp_v6_to_addr(union sctp_addr *addr, struct in6_addr *saddr, in sctp_v6_to_addr() argument
510 addr->sa.sa_family = AF_INET6; in sctp_v6_to_addr()
511 addr->v6.sin6_port = port; in sctp_v6_to_addr()
512 addr->v6.sin6_flowinfo = 0; in sctp_v6_to_addr()
513 addr->v6.sin6_addr = *saddr; in sctp_v6_to_addr()
514 addr->v6.sin6_scope_id = 0; in sctp_v6_to_addr()
558 static void sctp_v6_inaddr_any(union sctp_addr *addr, __be16 port) in sctp_v6_inaddr_any() argument
560 memset(addr, 0x00, sizeof(union sctp_addr)); in sctp_v6_inaddr_any()
561 addr->v6.sin6_family = AF_INET6; in sctp_v6_inaddr_any()
562 addr->v6.sin6_port = port; in sctp_v6_inaddr_any()
566 static int sctp_v6_is_any(const union sctp_addr *addr) in sctp_v6_is_any() argument
568 return ipv6_addr_any(&addr->v6.sin6_addr); in sctp_v6_is_any()
572 static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp) in sctp_v6_available() argument
575 const struct in6_addr *in6 = (const struct in6_addr *)&addr->v6.sin6_addr; in sctp_v6_available()
583 sctp_v6_map_v4(addr); in sctp_v6_available()
584 return sctp_get_af_specific(AF_INET)->available(addr, sp); in sctp_v6_available()
599 static int sctp_v6_addr_valid(union sctp_addr *addr, in sctp_v6_addr_valid() argument
603 int ret = ipv6_addr_type(&addr->v6.sin6_addr); in sctp_v6_addr_valid()
612 sctp_v6_map_v4(addr); in sctp_v6_addr_valid()
613 return sctp_get_af_specific(AF_INET)->addr_valid(addr, sp, skb); in sctp_v6_addr_valid()
624 static sctp_scope_t sctp_v6_scope(union sctp_addr *addr) in sctp_v6_scope() argument
633 v6scope = ipv6_addr_scope(&addr->v6.sin6_addr); in sctp_v6_scope()
710 static int sctp_v6_addr_to_user(struct sctp_sock *sp, union sctp_addr *addr) in sctp_v6_addr_to_user() argument
713 if (addr->sa.sa_family == AF_INET) in sctp_v6_addr_to_user()
714 sctp_v4_map_v6(addr); in sctp_v6_addr_to_user()
716 if (addr->sa.sa_family == AF_INET6 && in sctp_v6_addr_to_user()
717 ipv6_addr_v4mapped(&addr->v6.sin6_addr)) in sctp_v6_addr_to_user()
718 sctp_v6_map_v4(addr); in sctp_v6_addr_to_user()
721 if (addr->sa.sa_family == AF_INET) in sctp_v6_addr_to_user()
740 static void sctp_v6_seq_dump_addr(struct seq_file *seq, union sctp_addr *addr) in sctp_v6_seq_dump_addr() argument
742 seq_printf(seq, "%pI6 ", &addr->v6.sin6_addr); in sctp_v6_seq_dump_addr()
754 union sctp_addr *addr; in sctp_inet6_event_msgname() local
761 addr = (union sctp_addr *)msgname; in sctp_inet6_event_msgname()
766 addr->v4.sin_family = AF_INET; in sctp_inet6_event_msgname()
767 addr->v4.sin_port = htons(asoc->peer.port); in sctp_inet6_event_msgname()
768 addr->v4.sin_addr = paddr->v4.sin_addr; in sctp_inet6_event_msgname()
770 addr->v6.sin6_family = AF_INET6; in sctp_inet6_event_msgname()
771 addr->v6.sin6_flowinfo = 0; in sctp_inet6_event_msgname()
773 addr->v6.sin6_scope_id = paddr->v6.sin6_scope_id; in sctp_inet6_event_msgname()
775 addr->v6.sin6_scope_id = 0; in sctp_inet6_event_msgname()
776 addr->v6.sin6_port = htons(asoc->peer.port); in sctp_inet6_event_msgname()
777 addr->v6.sin6_addr = paddr->v6.sin6_addr; in sctp_inet6_event_msgname()
780 *addrlen = sctp_v6_addr_to_user(sctp_sk(asoc->base.sk), addr); in sctp_inet6_event_msgname()
787 union sctp_addr *addr; in sctp_inet6_skb_msgname() local
793 addr = (union sctp_addr *)msgname; in sctp_inet6_skb_msgname()
797 addr->v4.sin_family = AF_INET; in sctp_inet6_skb_msgname()
798 addr->v4.sin_port = sh->source; in sctp_inet6_skb_msgname()
799 addr->v4.sin_addr.s_addr = ip_hdr(skb)->saddr; in sctp_inet6_skb_msgname()
801 addr->v6.sin6_family = AF_INET6; in sctp_inet6_skb_msgname()
802 addr->v6.sin6_flowinfo = 0; in sctp_inet6_skb_msgname()
803 addr->v6.sin6_port = sh->source; in sctp_inet6_skb_msgname()
804 addr->v6.sin6_addr = ipv6_hdr(skb)->saddr; in sctp_inet6_skb_msgname()
805 if (ipv6_addr_type(&addr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL) { in sctp_inet6_skb_msgname()
807 addr->v6.sin6_scope_id = ev->iif; in sctp_inet6_skb_msgname()
809 addr->v6.sin6_scope_id = 0; in sctp_inet6_skb_msgname()
813 *addr_len = sctp_v6_addr_to_user(sctp_sk(skb->sk), addr); in sctp_inet6_skb_msgname()
865 static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr) in sctp_inet6_bind_verify() argument
870 if (addr->sa.sa_family != AF_INET6) in sctp_inet6_bind_verify()
871 af = sctp_get_af_specific(addr->sa.sa_family); in sctp_inet6_bind_verify()
873 int type = ipv6_addr_type(&addr->v6.sin6_addr); in sctp_inet6_bind_verify()
878 if (!addr->v6.sin6_scope_id) in sctp_inet6_bind_verify()
882 dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id); in sctp_inet6_bind_verify()
884 !ipv6_chk_addr(net, &addr->v6.sin6_addr, dev, 0)) { in sctp_inet6_bind_verify()
893 return af->available(addr, opt); in sctp_inet6_bind_verify()
899 static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr) in sctp_inet6_send_verify() argument
904 if (addr->sa.sa_family != AF_INET6) in sctp_inet6_send_verify()
905 af = sctp_get_af_specific(addr->sa.sa_family); in sctp_inet6_send_verify()
907 int type = ipv6_addr_type(&addr->v6.sin6_addr); in sctp_inet6_send_verify()
911 if (!addr->v6.sin6_scope_id) in sctp_inet6_send_verify()
915 addr->v6.sin6_scope_id); in sctp_inet6_send_verify()