A number of bug-fixes inspired by Mark Treacy:

- Allow PPP to run multicasts natively.
- Deal properly with lots of similarly-named interfaces.
- Don't sign-extend if_flags.

NB: the last fix (to rtsock.c) must be reversed when we expand if_flags to a
reasonable size.

Submitted by:	Mark Treacy
This commit is contained in:
Garrett Wollman 1994-10-05 20:11:28 +00:00
parent 29568da84a
commit 2624cf89f9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=3377
3 changed files with 32 additions and 10 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if.c 8.3 (Berkeley) 1/4/94
* $Id: if.c,v 1.6 1994/08/18 22:35:19 wollman Exp $
* $Id: if.c,v 1.7 1994/09/16 05:47:03 phk Exp $
*/
#include <sys/param.h>
@ -43,6 +43,7 @@
#include <sys/protosw.h>
#include <sys/kernel.h>
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <net/if.h>
#include <net/if_dl.h>
@ -621,10 +622,19 @@ ifconf(cmd, data)
ifrp = ifc->ifc_req;
ep = ifr.ifr_name + sizeof (ifr.ifr_name) - 2;
for (; space > sizeof (ifr) && ifp; ifp = ifp->if_next) {
strncpy(ifr.ifr_name, ifp->if_name, sizeof (ifr.ifr_name) - 2);
for (cp = ifr.ifr_name; cp < ep && *cp; cp++)
continue;
*cp++ = '0' + ifp->if_unit; *cp = '\0';
char workbuf[12], *unitname;
int unitlen, ifnlen;
unitname = sprint_d(ifp->if_unit, workbuf, sizeof workbuf);
unitlen = strlen(unitname);
ifnlen = strlen(ifp->if_name);
if(unitlen + ifnlen + 1 > sizeof ifr.ifr_name) {
error = ENAMETOOLONG;
} else {
strcpy(ifr.ifr_name, ifp->if_name);
strcpy(&ifr.ifr_name[ifnlen], unitname);
}
if ((ifa = ifp->if_addrlist) == 0) {
bzero((caddr_t)&ifr.ifr_addr, sizeof(ifr.ifr_addr));
error = copyout((caddr_t)&ifr, (caddr_t)ifrp,

View File

@ -69,7 +69,7 @@
* Paul Mackerras (paulus@cs.anu.edu.au).
*/
/* $Id: if_ppp.c,v 1.7 1994/01/25 05:56:06 deraadt Exp paulus $ */
/* $Id: if_ppp.c,v 1.2 1994/09/23 00:13:18 wollman Exp $ */
/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
#include "ppp.h"
@ -192,7 +192,7 @@ pppattach()
sc->sc_if.if_name = "ppp";
sc->sc_if.if_unit = i++;
sc->sc_if.if_mtu = PPP_MTU;
sc->sc_if.if_flags = IFF_POINTOPOINT;
sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
sc->sc_if.if_type = IFT_PPP;
sc->sc_if.if_hdrlen = PPP_HDRLEN;
sc->sc_if.if_ioctl = pppioctl;
@ -1489,6 +1489,18 @@ pppioctl(ifp, cmd, data)
case SIOCGIFMTU:
ifr->ifr_mtu = sc->sc_if.if_mtu;
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
switch(ifr->ifr_addr.sa_family) {
#ifdef INET
case AF_INET:
break;
#endif
default:
error = EAFNOSUPPORT;
break;
}
break;
default:
error = EINVAL;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)rtsock.c 8.3 (Berkeley) 1/4/94
* $Id: rtsock.c,v 1.3 1994/08/02 07:46:44 davidg Exp $
* $Id: rtsock.c,v 1.4 1994/10/04 06:49:53 phk Exp $
*/
#include <sys/param.h>
@ -544,7 +544,7 @@ rt_ifmsg(ifp)
return;
ifm = mtod(m, struct if_msghdr *);
ifm->ifm_index = ifp->if_index;
ifm->ifm_flags = ifp->if_flags;
ifm->ifm_flags = (u_short)ifp->if_flags;
ifm->ifm_data = ifp->if_data;
ifm->ifm_addrs = 0;
route_proto.sp_protocol = 0;
@ -674,7 +674,7 @@ sysctl_iflist(af, w)
ifm = (struct if_msghdr *)w->w_tmem;
ifm->ifm_index = ifp->if_index;
ifm->ifm_flags = ifp->if_flags;
ifm->ifm_flags = (u_short)ifp->if_flags;
ifm->ifm_data = ifp->if_data;
ifm->ifm_addrs = info.rti_addrs;
if (error = copyout((caddr_t)ifm, w->w_where, len))