Deleted Added
full compact
in6_pcb.c (121770) in6_pcb.c (122922)
1/* $FreeBSD: head/sys/netinet6/in6_pcb.c 121770 2003-10-30 23:02:51Z sam $ */
1/* $FreeBSD: head/sys/netinet6/in6_pcb.c 122922 2003-11-20 20:07:39Z andre $ */
2/* $KAME: in6_pcb.c,v 1.31 2001/05/21 05:45:10 jinmei Exp $ */
3
4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions

--- 322 unchanged lines hidden (view full) ---

332 }
333 {
334 /*
335 * XXX: in6_selectsrc might replace the bound local address
336 * with the address specified by setsockopt(IPV6_PKTINFO).
337 * Is it the intended behavior?
338 */
339 *plocal_addr6 = in6_selectsrc(sin6, inp->in6p_outputopts,
2/* $KAME: in6_pcb.c,v 1.31 2001/05/21 05:45:10 jinmei Exp $ */
3
4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions

--- 322 unchanged lines hidden (view full) ---

332 }
333 {
334 /*
335 * XXX: in6_selectsrc might replace the bound local address
336 * with the address specified by setsockopt(IPV6_PKTINFO).
337 * Is it the intended behavior?
338 */
339 *plocal_addr6 = in6_selectsrc(sin6, inp->in6p_outputopts,
340 inp->in6p_moptions,
341 &inp->in6p_route,
340 inp->in6p_moptions, NULL,
342 &inp->in6p_laddr, &error);
343 if (*plocal_addr6 == 0) {
344 if (error == 0)
345 error = EADDRNOTAVAIL;
346 return (error);
347 }
348 /*
349 * Don't do pcblookup call here; return interface in
350 * plocal_addr6
351 * and exit to caller, that will do the lookup.
352 */
353 }
341 &inp->in6p_laddr, &error);
342 if (*plocal_addr6 == 0) {
343 if (error == 0)
344 error = EADDRNOTAVAIL;
345 return (error);
346 }
347 /*
348 * Don't do pcblookup call here; return interface in
349 * plocal_addr6
350 * and exit to caller, that will do the lookup.
351 */
352 }
354
355 if (inp->in6p_route.ro_rt)
356 ifp = inp->in6p_route.ro_rt->rt_ifp;
357
358 return (0);
359}
360
361/*
362 * Outer subroutine:
363 * Connect from a socket to a specified address.
364 * Both address and port must be specified in argument sin.
365 * If don't have a local address for this socket yet,

--- 76 unchanged lines hidden (view full) ---

442
443 if (so) {
444 so->so_pcb = NULL;
445 sotryfree(so);
446 }
447
448 ip6_freepcbopts(inp->in6p_outputopts);
449 ip6_freemoptions(inp->in6p_moptions);
353 return (0);
354}
355
356/*
357 * Outer subroutine:
358 * Connect from a socket to a specified address.
359 * Both address and port must be specified in argument sin.
360 * If don't have a local address for this socket yet,

--- 76 unchanged lines hidden (view full) ---

437
438 if (so) {
439 so->so_pcb = NULL;
440 sotryfree(so);
441 }
442
443 ip6_freepcbopts(inp->in6p_outputopts);
444 ip6_freemoptions(inp->in6p_moptions);
450 if (inp->in6p_route.ro_rt)
451 RTFREE(inp->in6p_route.ro_rt);
452 /* Check and free IPv4 related resources in case of mapped addr */
453 if (inp->inp_options)
454 (void)m_free(inp->inp_options);
455 ip_freemoptions(inp->inp_moptions);
456 inp->inp_vflag = 0;
457 INP_LOCK_DESTROY(inp);
458 uma_zfree(ipi->ipi_zone, inp);
459}

--- 365 unchanged lines hidden (view full) ---

825 * about service problems. For now, invalidate cached
826 * routing information. If the route was created dynamically
827 * (by a redirect), time to try a default gateway again.
828 */
829void
830in6_losing(in6p)
831 struct inpcb *in6p;
832{
445 /* Check and free IPv4 related resources in case of mapped addr */
446 if (inp->inp_options)
447 (void)m_free(inp->inp_options);
448 ip_freemoptions(inp->inp_moptions);
449 inp->inp_vflag = 0;
450 INP_LOCK_DESTROY(inp);
451 uma_zfree(ipi->ipi_zone, inp);
452}

--- 365 unchanged lines hidden (view full) ---

818 * about service problems. For now, invalidate cached
819 * routing information. If the route was created dynamically
820 * (by a redirect), time to try a default gateway again.
821 */
822void
823in6_losing(in6p)
824 struct inpcb *in6p;
825{
833 struct rtentry *rt;
834 struct rt_addrinfo info;
835
836 if ((rt = in6p->in6p_route.ro_rt) != NULL) {
837 RT_LOCK(rt);
838 in6p->in6p_route.ro_rt = NULL;
839 bzero((caddr_t)&info, sizeof(info));
840 info.rti_flags = rt->rt_flags;
841 info.rti_info[RTAX_DST] = rt_key(rt);
842 info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
843 info.rti_info[RTAX_NETMASK] = rt_mask(rt);
844 rt_missmsg(RTM_LOSING, &info, rt->rt_flags, 0);
845 if (rt->rt_flags & RTF_DYNAMIC)
846 rtexpunge(rt);
847 RTFREE_LOCKED(rt);
848 /*
849 * A new route can be allocated
850 * the next time output is attempted.
851 */
852 }
826 /*
827 * We don't store route pointers in the routing table anymore
828 */
829 return;
853}
854
855/*
856 * After a routing change, flush old routing
857 * and allocate a (hopefully) better one.
858 */
859struct inpcb *
860in6_rtchange(inp, errno)
861 struct inpcb *inp;
862 int errno;
863{
830}
831
832/*
833 * After a routing change, flush old routing
834 * and allocate a (hopefully) better one.
835 */
836struct inpcb *
837in6_rtchange(inp, errno)
838 struct inpcb *inp;
839 int errno;
840{
864 if (inp->in6p_route.ro_rt) {
865 RTFREE(inp->in6p_route.ro_rt);
866 inp->in6p_route.ro_rt = 0;
867 /*
868 * A new route can be allocated the next time
869 * output is attempted.
870 */
871 }
841 /*
842 * We don't store route pointers in the routing table anymore
843 */
872 return inp;
873}
874
875/*
876 * Lookup PCB in hash list.
877 */
878struct inpcb *
879in6_pcblookup_hash(pcbinfo, faddr, fport_arg, laddr, lport_arg, wildcard, ifp)

--- 81 unchanged lines hidden ---
844 return inp;
845}
846
847/*
848 * Lookup PCB in hash list.
849 */
850struct inpcb *
851in6_pcblookup_hash(pcbinfo, faddr, fport_arg, laddr, lport_arg, wildcard, ifp)

--- 81 unchanged lines hidden ---