Commit Graph

1922 Commits

Author SHA1 Message Date
elad
7f1171f976 - Make kauth(9) call logic match the one in netinet6/in6_pcb.c
- Indent a comment
2009-04-23 17:02:26 +00:00
elad
f2eb9b87ec Some changes to in_pcbbind():
- Extract guts to in_pcbbind_{addr,port}()

  - Put the port auto-assignment logic in in_pcbsetport(), which looks very
    similar to in6_pcbsetport()

  - Fix a bug where "sin" was passed to kauth(9) without being set to
    anything

No objections on tech-net@.
2009-04-23 16:42:56 +00:00
tsutsui
d779b85d3e Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
2009-04-18 14:58:02 +00:00
elad
d0cccdd5f2 Pass the lwp argument to in6_pcbbind() for the INET6 PRU_LISTEN and
PRU_CONNECT cases of tcp_usrreq(). It seems they were forgotten a long
time ago.

Similar code in FreeBSD and OpenBSD passes the thread (credentials)/proc.
2009-04-17 01:48:22 +00:00
elad
2d1c968399 Remove a few KAUTH_GENERIC_ISSUSER in favor of more descriptive
alternatives.

Discussed on tech-kern:

	http://mail-index.netbsd.org/tech-kern/2009/04/11/msg004798.html

Input from ad@, christos@, dyoung@, tsutsui@.

Okay ad@.
2009-04-15 20:44:24 +00:00
elad
d91dbb36b0 Don't set sin->sin_port and sin6->sin6_port to 0 before calling
ifa_ifwithaddr(), as we no longer do a byte compare on the entire struct.

Reviewed by and okay from dyoung@.
2009-04-14 21:25:20 +00:00
cegger
e2cb85904d bcopy -> memcpy 2009-03-18 17:06:41 +00:00
cegger
c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
cegger
35fb64746b bcmp -> memcmp 2009-03-18 15:14:29 +00:00
cegger
164477c65a ansify function definitions 2009-03-15 22:16:09 +00:00
cegger
dc56dbbd97 ansify function definitions 2009-03-15 21:23:31 +00:00
mrg
ce98775552 like KERN_FILE2: *do* update "needed" when there is no count. we want
userland to know what sort of size to provide..

while here, slightly normalise the previous to init_sysctl.c.
2009-03-11 05:55:22 +00:00
pooka
09835b3076 include opt_gateway 2009-02-28 18:31:12 +00:00
yamt
482389422a sysctl_net_inet_ip_ports: fix ipv6 sysctls. 2009-02-18 13:18:32 +00:00
yamt
9645d41cf8 remove unused #define. 2009-02-18 13:17:50 +00:00
christos
942a145f69 PR/40603: Christoph Badura: unprivileged users can add and delete interface
link addresses. Fixed by centralizing the test as suggested. Will pull up
to 5.0 once submitter tests the fix.
2009-02-12 19:05:36 +00:00
pooka
b660d07d87 Init ipflow pool dynamically instead of using a linkset. 2009-02-01 17:04:11 +00:00
pooka
c7a407f862 stinkset purge: POOL_INIT -> pool_init
also, make the syncache pool static in scope
2009-01-29 20:38:22 +00:00
christos
14ba6c67a5 Provide compatibility to the old timeval SCM_TIMESTAMP messages. 2009-01-19 02:27:57 +00:00
christos
461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
roy
2e3d0e5e22 The automatic addition of a subnet route should not error if a manually
added route already exists. Fixes PR kern/40133.
2008-12-21 19:07:35 +00:00
cegger
dcf705893e use M_ZERO on malloc() and remove subsequent bzero(). 2008-12-19 18:49:37 +00:00
cegger
9b87d582bd kill MALLOC and FREE macros. 2008-12-17 20:51:31 +00:00
pooka
c6e7028d1c Make dom_maxrtkey of inet/inet6domain the size of the ip_encap pack
structures.  This is far from optimal, but gets rid of iffy
#ifdef INET in radix.c.  The radix bonsai still needs lots of love
before loading domains dynamically is possible...
2008-11-25 18:28:05 +00:00
rmind
f2828c5040 ip_input: fix an IPQ "lock" leak. (hi <matt>!) 2008-11-23 19:52:38 +00:00
joerg
ba1c83c8cc Fix indentation. 2008-11-21 16:08:57 +00:00
ad
56e065b970 Oops, make these build. 2008-11-20 10:22:11 +00:00
ad
226bc85b61 Rename the accept filter modules to make module name match filter name. 2008-11-20 09:58:45 +00:00
ad
0efea177e3 Remove LKMs and switch to the module framework, pass 1.
Proposed on tech-kern@.
2008-11-12 12:35:50 +00:00
uebayasi
ed729f9508 Whitespace. 2008-11-10 01:06:43 +00:00
bouyer
71d4948e50 Fix kern/39769: race condition in TCP timers
When a TCP timer is disarmed (with callout_stop()) in the general case
callout_invoking() isn't checked, so the timer handler could be called run
when the current interrupt handler exits, athough the timer is disarmed.
This case cause bad things like TCPT_REXMT and TCPT_PERSIST being both pending,
causing a panic (see the PR for details).
Close the issue by aborting the handler if the timer is not callout_expired().
(the EXPIRED flag being cleared by callout_stop()).
2008-11-09 17:32:38 +00:00
dyoung
de87fe677d *** Summary ***
When a link-layer address changes (e.g., ifconfig ex0 link
02🇩🇪ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address.  (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior.  Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability.  KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR.  In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr.  That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR.  In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR.  For example, pull ..._init() out of any switch
statement that looks like this:

        switch (...->sa_family) {
        case ...:
                ..._init();
                ...
                break;
        ...
        default:
                ..._init();
                ...
                break;
        }

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

        switch (x & (IFF_UP|IFF_RUNNING)) {
        case 0:
                ...
                break;
        case IFF_RUNNING:
                ...
                break;
        case IFF_UP:
                ...
                break;
        case IFF_UP|IFF_RUNNING:
                ...
                break;
        }

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure.  Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls.  In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source.  In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively.  Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset.  Delete unnecessary casts to void *.  Use
sockaddr_in_init() and sockaddr_in6_init().  Compare pointers with
NULL instead of "testing truth".  Replace some instances of (type
*)0 with NULL.  Change some K&R prototypes to ANSI C, and join
lines.
2008-11-07 00:20:01 +00:00
dyoung
44a13e6f88 Cosmetic: change (type *)0 to NULL. 2008-11-06 03:34:37 +00:00
dyoung
cf969cfa5a Constify the rt_addrinfo argument to the ifa_rtrequest member
function of struct ifaddr.
2008-10-24 17:07:33 +00:00
ad
42d611dd37 arp_drain: no reason to complain if arp_lock is already held. 2008-10-21 11:22:21 +00:00
hans
c25473a894 if_input needs to be called at splnet(). ok by cube. 2008-10-19 23:28:31 +00:00
hans
b0d4e5c1a7 include bpf headers so that the bpf calls actually do something. ok by cube. 2008-10-16 18:56:56 +00:00
ad
978e1181ad Use designated initializers for struct accept_filter. 2008-10-14 13:05:44 +00:00
pooka
4a2061c973 POOL_INIT -> pool_init 2008-10-13 19:44:21 +00:00
plunky
d2fcfe2b55 update ip_pcbopts() to use sockopt(9) API.
cleans up function and one small fix is that we now stop copying user
options to the mbuf when the _EOL is given, previously this function
would continue to copy options.
2008-10-12 11:15:54 +00:00
plunky
dba87c3cd4 do not sleep while allocating memory here as socket lock is held 2008-10-12 10:23:18 +00:00
pooka
7e5aba5af0 Move uidinfo to its own module in kern_uidinfo.c and include in rump.
No functional change to uidinfo.
2008-10-11 13:40:57 +00:00
ad
a92b113db4 tcp_close: rearrange sequence of events slightly to make this atomic.
It was possible for a half-destroyed tcpcb to be visble, as softnet_lock
was being dropped.
2008-10-10 10:23:34 +00:00
ad
9fa0e0f258 tcp_delack: test for TF_DELACK. 2008-10-10 10:21:05 +00:00
pooka
308b8af180 POOL_INIT -> pool_init 2008-10-04 00:09:34 +00:00
pooka
e0b14794fc Hallo, pool_init(). Auf wiedersehen & byebye, link set POOL_INIT(). 2008-10-03 16:22:33 +00:00
rmind
b312c56767 PR/39664: Dave Huang: ip_mrouter_done: free hash using hashdone(9). 2008-10-01 16:01:51 +00:00
pooka
03c29b39c0 Don't wrap whole file in INET. 2008-09-25 15:48:57 +00:00
gmcgarry
0de5da9678 Replace most gcc-specific __attribute__ uses with BSD-style sys/cdef.h
preprocessor macros.
2008-09-08 23:36:53 +00:00
seanb
f36e2df47a Wrong route being consulted in one place
in ip_forward() after change to rtcache_*().
Restore previous behaviour.
2008-09-05 13:39:12 +00:00