summaryrefslogtreecommitdiffstats
path: root/sys/net/if_spppsubr.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add sizes to free() callskn2020-09-121-9/+15
| | | | | | These are the last ones in if_pppoe.c and if_spppsubr.c. OK beck
* Add sizes to free() callskn2020-08-221-21/+23
| | | | | | | | | | | | Simply reuse struct size or buffer length variables for free() the very same way they are used with malloc(), often within the same scope and/or only a few lines above. This leaves only a few selected free() calls with size zero in due to the fact that there is currently no variable to keep track of name and secret string lengths. OK mvs
* Zap LOOPALIVECNTkn2020-08-141-2/+1
| | | | | | Unused since r1.138 from 2015: "remove cisco hdlc code from sppp(4)". OK mpi
* Change users of IFQ_SET_MAXLEN() and IFQ_IS_EMPTY() to use the "new" API.patrick2020-07-101-3/+3
| | | | ok dlg@ tobhe@
* Change users of IFQ_PURGE() to use the "new" API.patrick2020-07-101-2/+2
| | | | ok dlg@ tobhe@
* Change users of IFQ_DEQUEUE(), IFQ_ENQUEUE() and IFQ_LEN() to use thepatrick2020-07-101-2/+2
| | | | | | "new" API. ok dlg@ tobhe@
* Non root users must not set the parameters of pppoe(4) interfaces.bluhm2019-11-131-1/+3
| | | | found by Ilja Van Sprundel; OK deraadt@ dlg@
* convert interface address change hooks to tasks and a task_list.dlg2019-11-081-3/+3
| | | | | | | | | | | | | | | this follows what's been done for detach and link state hooks, and makes handling of hooks generally more robust. address hooks are a bit different to detach/link state hooks in that there's only a few things that register hooks (carp, pf, vxlan), but a lot of places to run the hooks (lots of ipv4 and ipv6 address configuration). an address hook cookie was in struct pfi_kif, which is part of the pf abi. rather than break pfctl -sI, this maintains the void * used for the cookie and uses it to store a task, which is then used as intended with the new api.
* Use timeout_add_sec(9)kn2019-06-241-4/+4
| | | | | | | | | | Re-challenge timeouts are made up of single scalar factors which are multiplied with the time unit lcp.timeout to compute the timeout period. Simply reduce that unit of 1 * hz [ticks] to 1 [s] and use the appropiate API. OK mpi
* Make computation of re-challenge timeout more obviouskn2019-06-221-2/+2
| | | | | | | | | | | Instead of masking the difference between lower and upper bound to yield a random summand that fits, instruct the API to limit their result accordingly. 0x01fe = 510 = 810 - 300. arc4random_uniform(upper_bound) returns `upper_bound - 1' as maximum, so add one to make 810 a possible value for `i'. OK deraadt
* Revert accidentially committed hunk from previouskn2019-06-221-2/+2
|
* Remove duplicate initialisationkn2019-06-221-3/+2
| | | | OK claudio semarie
* Prevent recursions by not deleting entries inside rtable_walk(9).mpi2019-06-211-2/+2
| | | | | | | | | | | | | | | rtable_walk(9) now passes a routing entry back to the caller when a non zero value is returned and if it asked for it. This allows us to call rtdeletemsg()/rtrequest_delete() from the caller without creating a recursion because of rtflushclone(). Multicast code hasn't been adapted and is still possibly creating recursions. However multicast route entries aren't cloned so if a recursion exists it isn't because of rtflushclone(). Fix stack exhaustion triggered by the use of "-msave-args". Issue reported by Dániel Lévai on bugs@ confirmed by and ok bluhm@.
* Remove almost unused `flags' argument of suser().mpi2018-02-191-2/+2
| | | | | | | The account flag `ASU' will no longer be set but that makes suser() mpsafe since it no longer mess with a per-process field. No objection from millert@, ok tedu@, bluhm@
* Kill dead ioctl handlers.mpi2017-10-201-7/+1
| | | | | | | SIOCGIF{HARD,}MTU are handled by ifioctl() and not passed down to drivers. ok visa@
* After we stopped processing router advertisements in the kernelflorian2017-08-151-3/+3
| | | | | | | | sppp_update_ip6_addr() became the last user of n6_are_prefix_equal(). Since it compares /128 prefixes it doesn't need all the bells and whistles and can be converted to a memcmp. Remove the now unused n6_are_prefix_equal(). OK bluhm, mpi
* Use the rv variable in sppp_output() as it was intended.reyk2017-08-141-2/+2
| | | | | | | | | | | | | | | | | sppp_output has the following comment: "Don't choke with an ENETDOWN early. It's possible that we just started dialing out, so don't drop the packet immediately. If we notice that we run out of buffer space below, we will however remember that we are not ready to carry IPv6 packets, and return ENETDOWN, as opposed to ENOBUFS." A later revision of the code just returned ENOBUFS anyway, ignoring the rv variable that might have ENETDOWN instead, turning rv into an unused variable. Coverity CID 1299246; Severity: Minor OK sthen@
* Remove NET_LOCK()'s argument.mpi2017-08-111-13/+11
| | | | Tested by Hrvoje Popovski, ok bluhm@
* space after if.reyk2017-08-111-3/+3
| | | | Pointed out by tom@
* Revision 1.139 accidentally removed an ip = mtod(), resulting in areyk2017-08-111-1/+4
| | | | | | | | pointless "ip = NULL; if (ip) ..." sequence. Coverity CID 1453286; Severity: Minor OK sthen@ tom@
* The timeval in sppp_input() is also used when the interface is not IFF_UP.reyk2017-08-111-2/+3
| | | | | | | | Always call getmicrouptime(&tv) to avoid an "Uninitialized scalar variable". Coverity CID 1453266; Severity: Insignificant OK deraadt@
* Add missing splx().mpi2017-08-011-1/+3
| | | | | | | | | | | | | I introduced this bug in 2015 but the splsoftnet()/splx() dance in the upper layer masked it. Pseudo drivers generally don't need any splnet() protection. Found by Mark Patruck and Andrei-Marius Radu since the NET_LOCK() no longer raise any IPL. Strangely jsg@ confirmed that cppcheck nor coccinelle found the missing splx(). ok kettenis@, sthen@, deraadt@
* In sppp(4), allow additional 'wildcard' addresses for the destination.stsp2017-06-161-2/+2
| | | | | | | | | | | | Any address within the range 0.0.0.1 - 0.0.0.255 can now be used. This allows for multiple pppoe(4) interfaces with dynamic addresses within the same routing table. Which used to work before OpenBSD 5.8, but since 5.8 only one interface in a routing table can use destination address 0.0.0.1. Problem first reported by Steve (fiverings04 at australian yahoo) on misc@. I ran into it on an EdgeRouter lite which is supposed to serve two ADSL lines. ok sthen@ mpi@ man page help from jmc@ for an earlier variant of this change
* Introduce ipv{4,6}_input(), two wrappers around IP queues.mpi2017-05-301-17/+10
| | | | | | | This will help transitionning to an un-KERNEL_LOCK()ed IP forwarding path. Disucssed with bluhm@, ok claudio@
* Avoid some false positives with cppcheck. No binary change.bluhm2017-04-141-2/+2
| | | | OK jsg@
* A space here, a space there. Soon we're talking real whitespacekrw2017-01-241-5/+5
| | | | rectification.
* remove some extra whitespace.dlg2017-01-211-15/+15
| | | | no functional change (unfortunately)
* No need to handle SIOCAIFADDR in drivers, it's never passed down tompi2017-01-201-2/+1
| | | | | | them. ok claudio@
* When if_down() is called, sppp_keepalive() needs a NET_LOCK().bluhm2017-01-081-3/+5
| | | | OK visa@ mpi@
* Grab the NET_LOCK() when setting an IPv6 address, just like it is donempi2017-01-021-11/+10
| | | | | | for IPv4. Assert reported and diff tested by semarie@
* Introduce the NET_LOCK() a rwlock used to serialize accesses to the partsmpi2016-12-191-8/+8
| | | | | | | | | | | of the network stack that are not yet ready to be executed in parallel or where new sleeping points are not possible. This first pass replace all the entry points leading to ip_output(). This is done to not introduce new sleeping points when trying to acquire ART's write lock, needed when a new L2 entry is created via the RT_RESOLVE. Inputs from and ok bluhm@, ok dlg@
* if_link_state_change() doesn't need to be called under splsoftnet(),mpi2016-11-161-4/+2
| | | | it just schedule a task.
* Path MTU discovery was slightly broken. I took two ICMP packetsbluhm2016-07-111-2/+2
| | | | | | | | | to create and change the dynamic route. This behavior was introduced in net/route.c rev 1.269 when the gateway route allocation was moved from rt_setgateway() to _rtalloc(). So rtrequest(RTM_ADD) could return a route without a valid gateway route. To fix this, call rt_setgwroute() from _rtalloc() and rt_setgateway(). OK mpi@
* Don't hardcode vlan/queue priority for pppoe packets; inherit it from thesthen2016-06-141-3/+3
| | | | | | new "llprio" setting on the pppoe(4) interface instead. Tested by Daniel Gillen and myself, ok mikeb
* Set pppoe(4) control frames to high (NC, "network control")sthen2016-05-301-1/+3
| | | | | | | | | | | | | | | priority. This is translated into an 802.1p priority tag when sent over a vlan interface, reducing the risk of them being crowded out by data packets on a busy link. Some users have problems with ISPs that place specific requirements on vlan priority (typically the packet header value must be '0', relating to priority 1). This diff doesn't fix that yet, but gives a single place to patch to change tags on control packets without affecting normal vlan priority operation on other interfaces. ok mikeb.
* Simplify life for routing table implementations by requiring that rtable_walkjmatthew2016-05-021-4/+2
| | | | | | | | | | | callbacks return EAGAIN if they modify the routing table. While we're here, simplify life for rtable_walk callers by moving the loop that restarts the walk on EAGAIN into rtable_walk itself. Flushing cloned routes on interface state changes becomes a bit more inefficient, but this can be improved later. ok mpi@ dlg@
* Remove a bogus "else" that was causing breakage with LCP echoes,sthen2016-05-011-2/+2
| | | | | | | | | bug introduced in r1.138. Reported at https://twitter.com/DarkSoul4242/status/722365165262405633 (twitter is *NOT* the place to report bugs!) and in https://marc.info/?l=openbsd-bugs&m=145988918010707&w=2, pointed out by tb@
* Remove the hack that prevents changing pppoe params at runtime.mikeb2016-04-181-15/+2
| | | | | | | | | | | The EBUSY hack imposes an order on the ifconfig commands issued against the pppoe interface used to configure the sppp layer below. To counter this we use the ENETRESET trick that other drivers use to tell the pppoe layer that sppp has requested a stop/init reset sequence to proceed which we oblige with in case pppoe is UP and RUNNING. Tested by semarie@ and Jan Schreiber <jes@posteo.de>, thanks!
* if_start needs splnet. help/ok dlg@sthen2015-11-231-2/+7
|
* sppp(4) is now only used for pppoe(4) which doesn't use framing, so removesthen2015-11-201-104/+27
| | | | | | | support for sppp with framing, simplifying things. Remove unused ifdefs while there. "sppp will go away before it gets used for something else" dlg@
* avoid a use after enqueue, which is like a use after free.dlg2015-11-201-13/+15
| | | | | | | | | | | once you enqueue an mbuf, you no longer own it. therefore you cant read the length out of it. this reads the length first, then tries to enq it. also, call if_start instead of a bare call to the underlying start routine. ok mpi@ sthen@
* replace the ifqueue used for the pp_cpq with an mbuf_queue.dlg2015-11-111-27/+10
|
* Rewrite rtalloc(9) to consider RTF_GATEWAY entries without valid next-mpi2015-11-091-4/+3
| | | | | | | | | | | | | | | hop route as invalid. Previously when such entrie was returned by rtalloc(9) a second route lookup was done in rt_checkgate() very late in the journey of a packet. In other words a single rtalloc(9) call can now result in multiple route lookups if a RTF_GATEWAY entry is returned. This is a step towards always calling L2 output functions with valid destination information. Tested by various including jmc@, naddy@, Hrvoje Popovski
* sppp_pick is unused, it can go away.dlg2015-11-021-21/+1
|
* Introduce if_rtrequest() the successor of ifa_rtrequest().mpi2015-10-251-3/+1
| | | | | | | | | L2 resolution depends on the protocol (encoded in the route entry) and an ``ifp''. Not having to care about an ``ifa'' makes our life easier in our MP effort. Fewer dependencies between data structures implies fewer headaches. Discussed with bluhm@, ok claudio@
* Some rt_ifp to rt_ifidx conversions.mpi2015-10-241-2/+2
| | | | ok bluhm@
* Revert if_oqdrops accounting changes done in kernel, per request from mpi@.uebayasi2015-10-051-1/+3
| | | | | | | | | | | | | (Especially adding IF_DROP() after IFQ_ENQUEUE() was completely wrong because IFQ_ENQUEUE() already does it. Oops.) After this revert, the situation becomes: - if_snd.ifq_drops is incremented in either IFQ_ENQUEUE() or IF_DROP(), but it is not shown to userland, and - if_data.ifi_oqdrops is shown to userland, but it is not incremented by anyone.
* Don't count IF_DROP()'ed packets as if_oerrors too.uebayasi2015-10-051-3/+1
| | | | | | mpi@ plans to clean-up IF_DROP()'s, but fix consistent use of it for now. OK dlg@
* Remove remnants of sppp's special queue handling for telnet/rlogin/ftp,sthen2015-09-301-16/+2
| | | | the rest was done in r1.96. ok mikeb@
* remove cisco hdlc code from sppp(4), it's no longer used - pppoe(4) only usessthen2015-09-301-278/+49
| | | | | ppp framing, and the drivers for sync serial cards have been removed so the sppp code is now only used to support pppoe(4). ok mpi@, kill it chris@