summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-04-05 12:19:38 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-04-05 12:19:38 +0000
commitad3024c93cd9c78f50888e66fabc2f41c2ff642b (patch)
tree7ca867a80bd2766253dd129a00b1b1689c37d230
parent6925dcc5a6aeebcfd28fd678a39f45cd5e642fc4 (diff)
Return EINVAL in SIOCSIFLLADDR if new lladdr is a multicast address.
OK derradt@ tedu@
-rw-r--r--sys/net/if.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 1f1420a29e4..d2b0eb1bed7 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.105 2005/03/30 02:55:36 tedu Exp $ */
+/* $OpenBSD: if.c,v 1.106 2005/04/05 12:19:37 claudio Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1352,12 +1352,14 @@ ifioctl(so, cmd, data, p)
return (error);
ifa = ifnet_addrs[ifp->if_index];
if (ifa == NULL)
- return(EINVAL);
+ return (EINVAL);
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
if (sdl == NULL)
- return(EINVAL);
+ return (EINVAL);
if (ifr->ifr_addr.sa_len != ETHER_ADDR_LEN)
- return(EINVAL);
+ return (EINVAL);
+ if (ETHER_IS_MULTICAST(ifr->ifr_addr.sa_data))
+ return (EINVAL);
switch (ifp->if_type) {
case IFT_ETHER:
case IFT_FDDI:
@@ -1365,7 +1367,8 @@ ifioctl(so, cmd, data, p)
case IFT_ISO88025:
case IFT_L2VLAN:
bcopy((caddr_t)ifr->ifr_addr.sa_data,
- (caddr_t)((struct arpcom *)ifp)->ac_enaddr, ETHER_ADDR_LEN);
+ (caddr_t)((struct arpcom *)ifp)->ac_enaddr,
+ ETHER_ADDR_LEN);
/* fall through */
case IFT_ARCNET:
bcopy((caddr_t)ifr->ifr_addr.sa_data,