Minor optimization doing input validation with a possible early return

before doing further work.

Sponsored by:	Cisco Systems, Inc.
This commit is contained in:
Bjoern A. Zeeb 2012-02-03 11:20:11 +00:00
parent ee799639e8
commit b3dd077152

View File

@ -1406,6 +1406,8 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
dst = ifa->ifa_addr;
netmask = ifa->ifa_netmask;
}
if (dst->sa_len == 0)
return(EINVAL);
switch (dst->sa_family) {
case AF_INET6:
case AF_INET:
@ -1427,8 +1429,6 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
startfib = fibnum;
endfib = fibnum;
}
if (dst->sa_len == 0)
return(EINVAL);
/*
* If it's a delete, check that if it exists,