Deleted Added
full compact
in6.c (139826) in6.c (142215)
1/* $FreeBSD: head/sys/netinet6/in6.c 139826 2005-01-07 02:30:35Z imp $ */
1/* $FreeBSD: head/sys/netinet6/in6.c 142215 2005-02-22 13:04:05Z glebius $ */
2/* $KAME: in6.c,v 1.259 2002/01/21 11:37:50 keiichi 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

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

201
202/*
203 * Add ownaddr as loopback rtentry. We previously add the route only if
204 * necessary (ex. on a p2p link). However, since we now manage addresses
205 * separately from prefixes, we should always add the route. We can't
206 * rely on the cloning mechanism from the corresponding interface route
207 * any more.
208 */
2/* $KAME: in6.c,v 1.259 2002/01/21 11:37:50 keiichi 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

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

201
202/*
203 * Add ownaddr as loopback rtentry. We previously add the route only if
204 * necessary (ex. on a p2p link). However, since we now manage addresses
205 * separately from prefixes, we should always add the route. We can't
206 * rely on the cloning mechanism from the corresponding interface route
207 * any more.
208 */
209static void
209void
210in6_ifaddloop(struct ifaddr *ifa)
211{
212 struct rtentry *rt;
213 int need_loop;
214
215 /* If there is no loopback entry, allocate one. */
216 rt = rtalloc1(ifa->ifa_addr, 0, 0);
217 need_loop = (rt == NULL || (rt->rt_flags & RTF_HOST) == 0 ||
218 (rt->rt_ifp->if_flags & IFF_LOOPBACK) == 0);
219 if (rt)
220 rtfree(rt);
221 if (need_loop)
222 in6_ifloop_request(RTM_ADD, ifa);
223}
224
225/*
226 * Remove loopback rtentry of ownaddr generated by in6_ifaddloop(),
227 * if it exists.
228 */
210in6_ifaddloop(struct ifaddr *ifa)
211{
212 struct rtentry *rt;
213 int need_loop;
214
215 /* If there is no loopback entry, allocate one. */
216 rt = rtalloc1(ifa->ifa_addr, 0, 0);
217 need_loop = (rt == NULL || (rt->rt_flags & RTF_HOST) == 0 ||
218 (rt->rt_ifp->if_flags & IFF_LOOPBACK) == 0);
219 if (rt)
220 rtfree(rt);
221 if (need_loop)
222 in6_ifloop_request(RTM_ADD, ifa);
223}
224
225/*
226 * Remove loopback rtentry of ownaddr generated by in6_ifaddloop(),
227 * if it exists.
228 */
229static void
229void
230in6_ifremloop(struct ifaddr *ifa)
231{
232 struct in6_ifaddr *ia;
233 struct rtentry *rt;
234 int ia_count = 0;
235
236 /*
237 * Some of BSD variants do not remove cloned routes

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

1546 /* set the rtrequest function to create llinfo */
1547 ia->ia_ifa.ifa_rtrequest = nd6_rtrequest;
1548 in6_ifaddloop(&(ia->ia_ifa));
1549 }
1550
1551 return (error);
1552}
1553
230in6_ifremloop(struct ifaddr *ifa)
231{
232 struct in6_ifaddr *ia;
233 struct rtentry *rt;
234 int ia_count = 0;
235
236 /*
237 * Some of BSD variants do not remove cloned routes

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

1546 /* set the rtrequest function to create llinfo */
1547 ia->ia_ifa.ifa_rtrequest = nd6_rtrequest;
1548 in6_ifaddloop(&(ia->ia_ifa));
1549 }
1550
1551 return (error);
1552}
1553
1554struct in6_multi_mship *
1555in6_joingroup(ifp, addr, errorp)
1556 struct ifnet *ifp;
1557 struct in6_addr *addr;
1558 int *errorp;
1559{
1560 struct in6_multi_mship *imm;
1561
1562 imm = malloc(sizeof(*imm), M_IPMADDR, M_NOWAIT);
1563 if (!imm) {
1564 *errorp = ENOBUFS;
1565 return NULL;
1566 }
1567 imm->i6mm_maddr = in6_addmulti(addr, ifp, errorp);
1568 if (!imm->i6mm_maddr) {
1569 /* *errorp is alrady set */
1570 free(imm, M_IPMADDR);
1571 return NULL;
1572 }
1573 return imm;
1574}
1575
1576int
1577in6_leavegroup(imm)
1578 struct in6_multi_mship *imm;
1579{
1580
1581 if (imm->i6mm_maddr)
1582 in6_delmulti(imm->i6mm_maddr);
1583 free(imm, M_IPMADDR);
1584 return 0;
1585}
1586
1554/*
1555 * Find an IPv6 interface link-local address specific to an interface.
1556 */
1557struct in6_ifaddr *
1558in6ifa_ifpforlinklocal(ifp, ignoreflags)
1559 struct ifnet *ifp;
1560 int ignoreflags;
1561{

--- 473 unchanged lines hidden ---
1587/*
1588 * Find an IPv6 interface link-local address specific to an interface.
1589 */
1590struct in6_ifaddr *
1591in6ifa_ifpforlinklocal(ifp, ignoreflags)
1592 struct ifnet *ifp;
1593 int ignoreflags;
1594{

--- 473 unchanged lines hidden ---