Deleted Added
full compact
if.c (16332) if.c (17096)
1/*
2 * Copyright (c) 1980, 1986, 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 * @(#)if.c 8.3 (Berkeley) 1/4/94
1/*
2 * Copyright (c) 1980, 1986, 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 * @(#)if.c 8.3 (Berkeley) 1/4/94
34 * $Id: if.c,v 1.31 1996/06/10 23:07:26 gpalmer Exp $
34 * $Id: if.c,v 1.32 1996/06/12 19:23:59 gpalmer Exp $
35 */
36
37#include <sys/param.h>
38#include <sys/queue.h>
39#include <sys/mbuf.h>
40#include <sys/systm.h>
41#include <sys/proc.h>
42#include <sys/socket.h>

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

157 ifa->ifa_addr = (struct sockaddr *)sdl;
158
159 sdl = (struct sockaddr_dl *)(socksize + (caddr_t)sdl);
160 ifa->ifa_netmask = (struct sockaddr *)sdl;
161 sdl->sdl_len = masklen;
162 while (namelen != 0)
163 sdl->sdl_data[--namelen] = 0xff;
164 }
35 */
36
37#include <sys/param.h>
38#include <sys/queue.h>
39#include <sys/mbuf.h>
40#include <sys/systm.h>
41#include <sys/proc.h>
42#include <sys/socket.h>

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

157 ifa->ifa_addr = (struct sockaddr *)sdl;
158
159 sdl = (struct sockaddr_dl *)(socksize + (caddr_t)sdl);
160 ifa->ifa_netmask = (struct sockaddr *)sdl;
161 sdl->sdl_len = masklen;
162 while (namelen != 0)
163 sdl->sdl_data[--namelen] = 0xff;
164 }
165 /*
166 * If they provided a slow input queue, initialize it.
167 */
168 if (ifp->if_poll_slowq) {
169 struct ifqueue *ifq = ifp->if_poll_slowq;
170
171 bzero(ifq, sizeof *ifq);
172 ifq->ifq_maxlen = ifqmaxlen;
173#ifdef POLLING
174 ifq->if_poll_recv = if_poll_recv_slow;
175#endif
176 }
177}
178/*
179 * Locate an interface based on a complete address.
180 */
181/*ARGSUSED*/
182struct ifaddr *
183ifa_ifwithaddr(addr)
184 register struct sockaddr *addr;

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

578 if (error == 0 )
579 microtime(&ifp->if_lastchange);
580 return(error);
581
582 default:
583 if (so->so_proto == 0)
584 return (EOPNOTSUPP);
585#ifndef COMPAT_43
165}
166/*
167 * Locate an interface based on a complete address.
168 */
169/*ARGSUSED*/
170struct ifaddr *
171ifa_ifwithaddr(addr)
172 register struct sockaddr *addr;

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

566 if (error == 0 )
567 microtime(&ifp->if_lastchange);
568 return(error);
569
570 default:
571 if (so->so_proto == 0)
572 return (EOPNOTSUPP);
573#ifndef COMPAT_43
586 return ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
587 (struct mbuf *)cmd, (struct mbuf *)data,
588 (struct mbuf *)ifp));
574 return ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd,
575 data,
576 ifp));
589#else
590 {
591 int ocmd = cmd;
592
593 switch (cmd) {
594
595 case SIOCSIFDSTADDR:
596 case SIOCSIFADDR:

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

618
619 case OSIOCGIFBRDADDR:
620 cmd = SIOCGIFBRDADDR;
621 break;
622
623 case OSIOCGIFNETMASK:
624 cmd = SIOCGIFNETMASK;
625 }
577#else
578 {
579 int ocmd = cmd;
580
581 switch (cmd) {
582
583 case SIOCSIFDSTADDR:
584 case SIOCSIFADDR:

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

606
607 case OSIOCGIFBRDADDR:
608 cmd = SIOCGIFBRDADDR;
609 break;
610
611 case OSIOCGIFNETMASK:
612 cmd = SIOCGIFNETMASK;
613 }
626 error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
627 /*
628 * XXX callees reverse the following bogus casts,
629 * but it would be easier to use a separate
630 * interface that is guaranteed to work.
631 */
632 (struct mbuf *)cmd, (struct mbuf *)data,
633 (struct mbuf *)ifp));
614 error = ((*so->so_proto->pr_usrreqs->pru_control)(so,
615 cmd,
616 data,
617 ifp));
634 switch (ocmd) {
635
636 case OSIOCGIFADDR:
637 case OSIOCGIFDSTADDR:
638 case OSIOCGIFBRDADDR:
639 case OSIOCGIFNETMASK:
640 *(u_short *)&ifr->ifr_addr = ifr->ifr_addr.sa_family;
641 }

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

754 space -= sizeof (ifr);
755 }
756 }
757 ifc->ifc_len -= space;
758 return (error);
759}
760
761SYSCTL_NODE(_net, PF_LINK, link, CTLFLAG_RW, 0, "Link layers");
618 switch (ocmd) {
619
620 case OSIOCGIFADDR:
621 case OSIOCGIFDSTADDR:
622 case OSIOCGIFBRDADDR:
623 case OSIOCGIFNETMASK:
624 *(u_short *)&ifr->ifr_addr = ifr->ifr_addr.sa_family;
625 }

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

738 space -= sizeof (ifr);
739 }
740 }
741 ifc->ifc_len -= space;
742 return (error);
743}
744
745SYSCTL_NODE(_net, PF_LINK, link, CTLFLAG_RW, 0, "Link layers");
746SYSCTL_NODE(_net_link, 0, generic, CTLFLAG_RW, 0, "Generic link-management");