summaryrefslogtreecommitdiff
path: root/sys/net/rtsock.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove __P.Alfred Perlstein2002-03-191-8/+7
| | | | Notes: svn path=/head/; revision=92725
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredJohn Baldwin2002-02-271-2/+2
| | | | | | | reference. Notes: svn path=/head/; revision=91406
* Prevent the kernel from generating an unaligned sysctl data buffer onAndrew Gallatin2002-01-271-0/+1
| | | | | | | | | | | | 64-bit platforms. The unaligned access is caused by struct ifa_msghdr not being a multiple of 8-bytes in size. If an interface has an odd number of addresses, this causes the next interface to generate an unaligned access in the user-level app walking the interfaces (ifconfig). Submitted by: Bernd Walter <ticso@cicely8.cicely.de> Notes: svn path=/head/; revision=89883
* Have sysctl() return the correct errno(2) as documented in theCrist J. Clark2002-01-251-1/+1
| | | | | | | | | | sysctl(3) manpage. Submitted by: ru Obtained from: BSD/OS Notes: svn path=/head/; revision=89768
* Introduce an interface announcement message for the routingRuslan Ermilov2002-01-181-0/+32
| | | | | | | | | | | | socket so that routing daemons and other interested parties know when an interface is attached/detached. PR: kern/33747 Obtained from: NetBSD MFC after: 2 weeks Notes: svn path=/head/; revision=89498
* It's no longer necessary to ensure that ``gate'' is set when RTF_GATEWAYBrian Somers2001-12-191-10/+0
| | | | | | | | | is passed, as subsequent code does that check now anyway. Submitted by: ru Notes: svn path=/head/; revision=88198
* Only call rt_getifa() if we've either been passed a gateway orBrian Somers2001-12-191-2/+8
| | | | | | | | | | | | | | | | | | if we've been given an RTA_IFP or changed RTA_IFA sockaddr. This fixes the following bug: >/dev/tun100 >/dev/tun101 ifconfig tun100 1.2.3.4 5.6.7.8 ifconfig tun101 1.2.3.4 6.7.8.9 route change 6.7.8.9 -ifa 1.2.3.4 -iface -mtu 500 which erroneously changed tun101's host route to have an ifp of tun100 (rt_getifa() sets the ifp after calling ifa_ifwithnet(1.2.3.4)) This incarnation submitted by: ru Notes: svn path=/head/; revision=88196
* Pull post-4.4BSD change to sys/net/route.c from BSD/OS 4.2.Ruslan Ermilov2001-10-171-21/+14
| | | | | | | | | | | | | | | | | | | | | | | Have sys/net/route.c:rtrequest1(), which takes ``rt_addrinfo *'' as the argument. Pass rt_addrinfo all the way down to rtrequest1 and ifa->ifa_rtrequest. 3rd argument of ifa->ifa_rtrequest is now ``rt_addrinfo *'' instead of ``sockaddr *'' (almost noone is using it anyways). Benefit: the following command now works. Previously we needed two route(8) invocations, "add" then "change". # route add -inet6 default ::1 -ifp gif0 Remove unsafe typecast in rtrequest(), from ``rtentry *'' to ``sockaddr *''. It was introduced by 4.3BSD-Reno and never corrected. Obtained from: BSD/OS, NetBSD MFC after: 1 month PR: kern/28360 Notes: svn path=/head/; revision=85074
* Bring in latest CSRG revisions to this file:Ruslan Ermilov2001-10-171-1/+9
| | | | | | | | | | | | | | - Report destination address of a P2P link when servicing routing socket messages. - Report interface name, address, and destination address of a P2P link when servicing NET_RT_{DUMP,FLAGS} sysctls. Part of CSRG revision 8.6 coresponds to revision 1.12. CSRG revision 8.7 corresponds to revision 1.15. Notes: svn path=/head/; revision=85053
* Change sysctl_iflist() so it has a single point of return. This willJonathan Lemon2001-09-291-3/+4
| | | | | | | assist any future locking efforts. Notes: svn path=/head/; revision=84105
* Use the current process's credentials rather than socket's cached.Ruslan Ermilov2001-09-201-2/+2
| | | | | | | | | | If the process drops its super-user privileges, we certainly don't want to allow it to modify routing tables. Discussed with: rwatson Notes: svn path=/head/; revision=83711
* KSE Milestone 2Julian Elischer2001-09-121-7/+7
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* Synch with NetBSD and OpenBSD.Ruslan Ermilov2001-08-311-1/+9
| | | | | | | | | | | | | Allow non-superuser to open, listen to, and send safe commands on the routing socket. Superuser priviledge is required for all commands but RTM_GET. Lose `setuid root' bit of route(8). Reviewed by: wollman, dd Notes: svn path=/head/; revision=82651
* fix memory leak when error during opening of routing socketJonathan Chen2001-08-021-0/+1
| | | | | | | | | PR: kern/29336 Submitted by: Richard Andrades <richard@xebeo.com> MFC after: 1 month Notes: svn path=/head/; revision=81065
* adjust mbuf length right in route_output().Hajimu UMEMOTO2001-07-041-1/+7
| | | | | | | | Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=79198
* Sync with recent KAME.Hajimu UMEMOTO2001-06-111-4/+11
| | | | | | | | | | | | | | | | | | | | | This work was based on kame-20010528-freebsd43-snap.tgz and some critical problem after the snap was out were fixed. There are many many changes since last KAME merge. TODO: - The definitions of SADB_* in sys/net/pfkeyv2.h are still different from RFC2407/IANA assignment because of binary compatibility issue. It should be fixed under 5-CURRENT. - ip6po_m member of struct ip6_pktopts is no longer used. But, it is still there because of binary compatibility issue. It should be removed under 5-CURRENT. Reviewed by: itojun Obtained from: KAME MFC after: 3 weeks Notes: svn path=/head/; revision=78064
* o Move per-process jail pointer (p->pr_prison) to inside of the subjectRobert Watson2001-02-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | credential structure, ucred (cr->cr_prison). o Allow jail inheritence to be a function of credential inheritence. o Abstract prison structure reference counting behind pr_hold() and pr_free(), invoked by the similarly named credential reference management functions, removing this code from per-ABI fork/exit code. o Modify various jail() functions to use struct ucred arguments instead of struct proc arguments. o Introduce jailed() function to determine if a credential is jailed, rather than directly checking pointers all over the place. o Convert PRISON_CHECK() macro to prison_check() function. o Move jail() function prototypes to jail.h. o Emulate the P_JAILED flag in fill_kinfo_proc() and no longer set the flag in the process flags field itself. o Eliminate that "const" qualifier from suser/p_can/etc to reflect mutex use. Notes: o Some further cleanup of the linux/jail code is still required. o It's now possible to consider resolving some of the process vs credential based permission checking confusion in the socket code. o Mutex protection of struct prison is still not present, and is required to protect the reference count plus some fields in the structure. Reviewed by: freebsd-arch Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=72786
* Mechanical change to use <sys/queue.h> macro API instead ofPoul-Henning Kamp2001-02-041-1/+1
| | | | | | | | | | fondling implementation details. Created with: sed(1) Reviewed by: md5(1) Notes: svn path=/head/; revision=71999
* Use <sys/queue.h> macro api rather than fondle its implementation detals.Poul-Henning Kamp2001-02-031-7/+7
| | | | | | | | Created with: /usr/bin/sed Reviewed by: /sbin/md5 Notes: svn path=/head/; revision=71959
* Convert more malloc+bzero to malloc+M_ZERO.David Malone2000-12-081-2/+2
| | | | | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net> Notes: svn path=/head/; revision=69781
* Workaround to avoid panic during detach pccard nic.Hajimu UMEMOTO2000-07-251-1/+4
| | | | Notes: svn path=/head/; revision=63841
* Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.Poul-Henning Kamp2000-07-041-1/+1
| | | | | | | Pointed out by: bde Notes: svn path=/head/; revision=62573
* Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:Poul-Henning Kamp2000-07-031-1/+1
| | | | | | | | | | | Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our sources: -sysctl_vm_zone SYSCTL_HANDLER_ARGS +sysctl_vm_zone (SYSCTL_HANDLER_ARGS) Notes: svn path=/head/; revision=62454
* Clean up some loose ends in the network code, including the X.25 and ISOPeter Wemm2000-02-131-6/+0
| | | | | | | | | | #ifdefs. Clean out unused netisr's and leftover netisr linker set gunk. Tested on x86 and alpha, including world. Approved by: jkh Notes: svn path=/head/; revision=57178
* Count AF_INET6 attachement to routing socket.Yoshinobu Inoue2000-01-281-0/+6
| | | | | | | Obtained from: KAME project Notes: svn path=/head/; revision=56761
* Make cloning mask sockaddr (genmask) possible.Ruslan Ermilov1999-12-281-1/+2
| | | | | | | | PR: kern/3061 Reviewed by: wollman Notes: svn path=/head/; revision=55178
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Postpone route_init() until all domains are attached.Luoqi Chen1999-04-291-2/+2
| | | | Notes: svn path=/head/; revision=46161
* This Implements the mumbled about "Jail" feature.Poul-Henning Kamp1999-04-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a seriously beefed up chroot kind of thing. The process is jailed along the same lines as a chroot does it, but with additional tough restrictions imposed on what the superuser can do. For all I know, it is safe to hand over the root bit inside a prison to the customer living in that prison, this is what it was developed for in fact: "real virtual servers". Each prison has an ip number associated with it, which all IP communications will be coerced to use and each prison has its own hostname. Needless to say, you need more RAM this way, but the advantage is that each customer can run their own particular version of apache and not stomp on the toes of their neighbors. It generally does what one would expect, but setting up a jail still takes a little knowledge. A few notes: I have no scripts for setting up a jail, don't ask me for them. The IP number should be an alias on one of the interfaces. mount a /proc in each jail, it will make ps more useable. /proc/<pid>/status tells the hostname of the prison for jailed processes. Quotas are only sensible if you have a mountpoint per prison. There are no privisions for stopping resource-hogging. Some "#ifdef INET" and similar may be missing (send patches!) If somebody wants to take it from here and develop it into more of a "virtual machine" they should be most welcome! Tools, comments, patches & documentation most welcome. Have fun... Sponsored by: http://www.rndassociates.com/ Run for almost a year by: http://www.servetheweb.com/ Notes: svn path=/head/; revision=46155
* Fix warnings in preparation for adding -Wall -Wcast-qual to theMatthew Dillon1999-01-271-3/+3
| | | | | | | kernel compile Notes: svn path=/head/; revision=43305
* Fixed bug in RTM_ADD where rmx_locks weren't being set on the new route,David Greenman1997-10-311-1/+4
| | | | | | | | preventing "route add default 1.2.3.4 -lock -mtu 1500" from working as expected (which is, BTW, to disable Path MTU Discovery). Notes: svn path=/head/; revision=30868
* Removed unused #includes.Bruce Evans1997-10-281-2/+1
| | | | Notes: svn path=/head/; revision=30813
* Last major round (Unless Bruce thinks of somthing :-) of malloc changes.Poul-Henning Kamp1997-10-121-1/+3
| | | | | | | | | | | Distribute all but the most fundamental malloc types. This time I also remembered the trick to making things static: Put "static" in front of them. A couple of finer points by: bde Notes: svn path=/head/; revision=30354
* Update network code to use poll support.Peter Wemm1997-09-141-2/+2
| | | | Notes: svn path=/head/; revision=29366
* Added used #include - don't depend on <sys/mbuf.h> includingBruce Evans1997-09-021-1/+2
| | | | | | | <sys/malloc.h> (unless we only use the bogusly shared M*WAIT flags). Notes: svn path=/head/; revision=29024
* Fix all areas of the system (or at least all those in LINT) to avoid storingGarrett Wollman1997-08-161-6/+6
| | | | | | | | | | | socket addresses in mbufs. (Socket buffers are the one exception.) A number of kernel APIs needed to get fixed in order to make this happen. Also, fix three protocol families which kept PCBs in mbufs to not malloc them instead. Delete some old compatibility cruft while we're at it, and add some new routines in the in_cksum family. Notes: svn path=/head/; revision=28270
* An actual fix for the routing default crashes thatJulian Elischer1997-07-181-15/+25
| | | | | | | | | | 1/ is compatible with the old route(1) in case needed. 2/ actually fixes the problem while vetting bad user input. note: I have already fixed route(1) so the problem shouldn't occur. if it does. use 0.0.0.0/0 instead of the word 'default' :) Notes: svn path=/head/; revision=27504
* Fix Julian's fixed fix. Routing is weird.Mike Smith1997-07-171-3/+6
| | | | | | | | | | We need to accept at least one sockaddr with zero length, in order to be able to set the default route. Suggested by: Phone conversation with Julian (sleep well!) Notes: svn path=/head/; revision=27476
* Bungled cut/paste leaves kernel with page faults..Julian Elischer1997-07-161-2/+3
| | | | | | | (read all about it!) Notes: svn path=/head/; revision=27458
* Finally track down the reason for some of my occasional kernel crashes.Julian Elischer1997-07-151-2/+20
| | | | | | | | | | Route(1) has a bug that sends a bad message to the kernel. The kernel trusts it and crashes. Add some sanity checks so that we don't trust the user quite as much any more. (also add a comment in if_ethersubr.c) Notes: svn path=/head/; revision=27431
* The long-awaited mega-massive-network-code- cleanup. Part I.Garrett Wollman1997-04-271-49/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit includes the following changes: 1) Old-style (pr_usrreq()) protocols are no longer supported, the compatibility glue for them is deleted, and the kernel will panic on boot if any are compiled in. 2) Certain protocol entry points are modified to take a process structure, so they they can easily tell whether or not it is possible to sleep, and also to access credentials. 3) SS_PRIV is no more, and with it goes the SO_PRIVSTATE setsockopt() call. Protocols should use the process pointer they are now passed. 4) The PF_LOCAL and PF_ROUTE families have been updated to use the new style, as has the `raw' skeleton family. 5) PF_LOCAL sockets now obey the process's umask when creating a socket in the filesystem. As a result, LINT is now broken. I'm hoping that some enterprising hacker with a bit more time will either make the broken bits work (should be easy for netipx) or dike them out. Notes: svn path=/head/; revision=25201
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notPeter Wemm1997-02-221-1/+1
| | | | | | | ready for it yet. Notes: svn path=/head/; revision=22975
* Make sure we have arguments to pass before calling ifaof_ifpforaddrBill Fenner1997-02-041-3/+3
| | | | | | | | | | and ifa_ifwithroute. This eliminates the panic seen in kern/2647, although it doesn't address the fact that RTM_CHANGE can't change flags. Notes: svn path=/head/; revision=22250
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673
* Use the new if_multiaddrs list for multicast addresses rather than theGarrett Wollman1997-01-131-1/+40
| | | | | | | | | | previous hackery involving struct in_ifaddr and arpcom. Get rid of the abominable multi_kludge. Update all network interfaces to use the new machanism. Distressingly few Ethernet drivers program the multicast filter properly (assuming the hardware has one, which it usually does). Notes: svn path=/head/; revision=21666
* Convert the interface address and IP interface address structuresGarrett Wollman1996-12-131-5/+5
| | | | | | | | | to TAILQs. Fix places which referenced these for no good reason that I can see (the references remain, but were fixed to compile again; they are still questionable). Notes: svn path=/head/; revision=20407
* Use queue macros for the list of interfaces. Next stop: ifaddrs!Garrett Wollman1996-12-111-2/+2
| | | | Notes: svn path=/head/; revision=20337
* Disallow host routes that point to themselves. These routes serve noBill Fenner1996-07-101-3/+3
| | | | | | | | | | | | | | purpose, other than to get in the way of the ARP table and cause "can't allocate llinfo" errors. This change may cause gated or routed to start complaining when adding such routes. If so, these programs will need to be fixed to not try to add these routes. Reviewed by: wollman Notes: svn path=/head/; revision=17052
* Clean up various compiler warnings. Most (if not all) were benignGary Palmer1996-05-081-2/+2
| | | | | | | Reviewed by: bde Notes: svn path=/head/; revision=15680
* Move or add #include <queue.h> in preparation for upcoming struct socketDavid Greenman1996-03-111-1/+2
| | | | | | | changes. Notes: svn path=/head/; revision=14546