Deleted Added
full compact
in.c (76469) in.c (78064)
1/*
2 * Copyright (c) 1982, 1986, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)in.c 8.4 (Berkeley) 1/9/95
1/*
2 * Copyright (c) 1982, 1986, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)in.c 8.4 (Berkeley) 1/9/95
34 * $FreeBSD: head/sys/netinet/in.c 76469 2001-05-11 14:37:34Z ru $
34 * $FreeBSD: head/sys/netinet/in.c 78064 2001-06-11 12:39:29Z ume $
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/sockio.h>
40#include <sys/malloc.h>
41#include <sys/socket.h>
42#include <sys/kernel.h>
43#include <sys/sysctl.h>
44
45#include <net/if.h>
46#include <net/if_types.h>
47#include <net/route.h>
48
49#include <netinet/in.h>
50#include <netinet/in_var.h>
51
52#include <netinet/igmp_var.h>
53
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/sockio.h>
40#include <sys/malloc.h>
41#include <sys/socket.h>
42#include <sys/kernel.h>
43#include <sys/sysctl.h>
44
45#include <net/if.h>
46#include <net/if_types.h>
47#include <net/route.h>
48
49#include <netinet/in.h>
50#include <netinet/in_var.h>
51
52#include <netinet/igmp_var.h>
53
54#include "gif.h"
55#if NGIF > 0
56#include <net/if_gif.h>
57#endif
58
59static MALLOC_DEFINE(M_IPMADDR, "in_multi", "internet multicast address");
60
61static int in_mask2len __P((struct in_addr *));
62static void in_len2mask __P((struct in_addr *, int));
63static int in_lifaddr_ioctl __P((struct socket *, u_long, caddr_t,
64 struct ifnet *, struct proc *));
65
66static void in_socktrim __P((struct sockaddr_in *));

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

195 register struct in_ifaddr *ia = 0, *iap;
196 register struct ifaddr *ifa;
197 struct in_ifaddr *oia;
198 struct in_aliasreq *ifra = (struct in_aliasreq *)data;
199 struct sockaddr_in oldaddr;
200 int error, hostIsNew, maskIsNew, s;
201 u_long i;
202
54static MALLOC_DEFINE(M_IPMADDR, "in_multi", "internet multicast address");
55
56static int in_mask2len __P((struct in_addr *));
57static void in_len2mask __P((struct in_addr *, int));
58static int in_lifaddr_ioctl __P((struct socket *, u_long, caddr_t,
59 struct ifnet *, struct proc *));
60
61static void in_socktrim __P((struct sockaddr_in *));

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

190 register struct in_ifaddr *ia = 0, *iap;
191 register struct ifaddr *ifa;
192 struct in_ifaddr *oia;
193 struct in_aliasreq *ifra = (struct in_aliasreq *)data;
194 struct sockaddr_in oldaddr;
195 int error, hostIsNew, maskIsNew, s;
196 u_long i;
197
203#if NGIF > 0
204 if (ifp && ifp->if_type == IFT_GIF) {
205 switch (cmd) {
206 case SIOCSIFPHYADDR:
207 case SIOCDIFPHYADDR:
208 if (p &&
209 (error = suser(p)) != 0)
210 return(error);
211 case SIOCGIFPSRCADDR:
212 case SIOCGIFPDSTADDR:
213 return gif_ioctl(ifp, cmd, data);
214 }
215 }
216#endif
217
218 switch (cmd) {
219 case SIOCALIFADDR:
220 case SIOCDLIFADDR:
221 if (p && (error = suser(p)) != 0)
222 return error;
223 /*fall through*/
224 case SIOCGLIFADDR:
225 if (!ifp)

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

708 flags |= RTF_HOST;
709 } else if (ifp->if_flags & IFF_POINTOPOINT) {
710 if (ia->ia_dstaddr.sin_family != AF_INET)
711 return (0);
712 flags |= RTF_HOST;
713 }
714 if ((error = rtinit(&(ia->ia_ifa), (int)RTM_ADD, flags)) == 0)
715 ia->ia_flags |= IFA_ROUTE;
198 switch (cmd) {
199 case SIOCALIFADDR:
200 case SIOCDLIFADDR:
201 if (p && (error = suser(p)) != 0)
202 return error;
203 /*fall through*/
204 case SIOCGLIFADDR:
205 if (!ifp)

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

688 flags |= RTF_HOST;
689 } else if (ifp->if_flags & IFF_POINTOPOINT) {
690 if (ia->ia_dstaddr.sin_family != AF_INET)
691 return (0);
692 flags |= RTF_HOST;
693 }
694 if ((error = rtinit(&(ia->ia_ifa), (int)RTM_ADD, flags)) == 0)
695 ia->ia_flags |= IFA_ROUTE;
696 /* XXX check if the subnet route points to the same interface */
697 if (error == EEXIST)
698 error = 0;
716
717 /*
718 * If the interface supports multicast, join the "all hosts"
719 * multicast group on that interface.
720 */
721 if (ifp->if_flags & IFF_MULTICAST) {
722 struct in_addr addr;
723

--- 138 unchanged lines hidden ---
699
700 /*
701 * If the interface supports multicast, join the "all hosts"
702 * multicast group on that interface.
703 */
704 if (ifp->if_flags & IFF_MULTICAST) {
705 struct in_addr addr;
706

--- 138 unchanged lines hidden ---