opnsense-src/sys/netgraph
Gleb Smirnoff 9165bf6297 In r248885 I have reduced size of fake uio resid that ng_ksocket(4) passes
to the soreceive(). This exposed a bug. When reading from a raw socket,
when our fake limit is depleted, we receive a truncated mbuf chain, with
m->m_pkthdr.len > m_length(m). The first problem is that MSG_TRUNC was not
handled. The second one is that we didn't reinit uio_resid in our endless
loop (neither flags), and if socket buffer contained several records, then
we quickly deplete our fake limit. The third bug, actually introduced in
r248885, is that MJUMPAGESIZE isn't enough to handle maximum packet that
ng_ksocket(4) can theoretically receive.

Changes:
- Reinit uio_resid and flags before every call to soreceive().
- Set maximum acceptable size of packet to IP_MAXPACKET. As for now the
  module doesn't support INET6.
- Properly handle MSG_TRUNC return from soreceive().

PR:			184601
Submitted & tested by:	Viktor Velichkin <avisom yandex.ru>
Sponsored by:		Nginx, Inc.
2013-12-21 14:41:32 +00:00
..
atm Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
bluetooth Add support for the BCM20702A0 chipset, ASUS USB-BT400. 2013-09-01 19:27:32 +00:00
netflow The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare 2013-10-26 17:58:36 +00:00
netgraph.h Refactor the name hash and the ID hash, that are used to address nodes: 2012-02-16 19:10:01 +00:00
ng_async.c Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
ng_async.h
ng_atmllc.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_atmllc.h
ng_base.c Improve locking model used to protect netgraph topology: 2013-10-15 17:44:35 +00:00
ng_bpf.c Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
ng_bpf.h
ng_bridge.c The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare 2013-10-26 17:58:36 +00:00
ng_bridge.h Add an optional "persistent" flag to ng_hub and ng_bridge, which if set, 2010-05-05 22:06:05 +00:00
ng_car.c Node constructor methods are supposed to be called in syscall 2011-04-18 09:12:27 +00:00
ng_car.h Add option to set packets per second limits instead of default 2007-12-19 22:50:14 +00:00
ng_cisco.c The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare 2013-10-26 17:58:36 +00:00
ng_cisco.h - Use fixed-width integer types. 2012-02-12 05:14:12 +00:00
ng_deflate.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_deflate.h A node that implements the Deflate sub-protocols of the Compression Control 2006-12-28 15:44:05 +00:00
ng_device.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_device.h
ng_echo.c
ng_echo.h
ng_eiface.c Include necessary headers that now are available due to pollution 2013-10-28 07:29:16 +00:00
ng_eiface.h Allow for MTU sizes of up to ETHER_MAX_LEN_JUMBO (i.e. 9018) bytes to be 2010-11-22 12:32:19 +00:00
ng_etf.c Node constructor methods are supposed to be called in syscall 2011-04-18 09:12:27 +00:00
ng_etf.h
ng_ether.c Include necessary headers that now are available due to pollution 2013-10-28 07:29:16 +00:00
ng_ether.h
ng_ether_echo.c Add a trivial node to reflect ethernet frames to whence they came. 2008-12-25 00:01:29 +00:00
ng_ether_echo.h Add a trivial node to reflect ethernet frames to whence they came. 2008-12-25 00:01:29 +00:00
ng_frame_relay.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_frame_relay.h
ng_gif.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_gif.h
ng_gif_demux.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_gif_demux.h
ng_hole.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_hole.h
ng_hub.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_hub.h Add an optional "persistent" flag to ng_hub and ng_bridge, which if set, 2010-05-05 22:06:05 +00:00
ng_iface.c Restore the entropy gathering from the m_data pointer value, not the 2013-11-02 15:13:02 +00:00
ng_iface.h Check for infinite recursion possible on some broken PPTP/L2TP/... VPN setups. 2009-01-20 22:26:09 +00:00
ng_ip_input.c Introduce a mechanism for detecting calls from outbound path of the 2009-06-11 16:50:49 +00:00
ng_ip_input.h
ng_ipfw.c The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare 2013-10-26 17:58:36 +00:00
ng_ipfw.h bring the NGM_IPFW_COOKIE back into ng_ipfw.h, libnetgraph expects 2009-12-28 12:29:13 +00:00
ng_ksocket.c In r248885 I have reduced size of fake uio resid that ng_ksocket(4) passes 2013-12-21 14:41:32 +00:00
ng_ksocket.h
ng_l2tp.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_l2tp.h
ng_lmi.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_lmi.h
ng_message.h World now builds without these defines, so eliminate them. 2009-06-09 07:07:20 +00:00
ng_mppc.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_mppc.h
ng_nat.c Add NGM_NAT_LIBALIAS_INFO command, that reports internal stats 2013-03-21 08:36:15 +00:00
ng_nat.h Add NGM_NAT_LIBALIAS_INFO command, that reports internal stats 2013-03-21 08:36:15 +00:00
ng_one2many.c Remove unsigned < 0 comparison. 2013-10-26 17:43:18 +00:00
ng_one2many.h Add XMIT_FAILOVER transmit algorithm to ng_one2many node. Packets are 2011-03-01 13:10:56 +00:00
ng_parse.c Fix compilation warning. 2013-02-15 07:58:51 +00:00
ng_parse.h
ng_patch.c Fix panic in ng_patch(4) caused by checksum flags being added to mbuf flags. 2012-04-22 17:00:52 +00:00
ng_patch.h Style(9) fixes: 2010-06-10 16:45:30 +00:00
ng_pipe.c Eliminate duplicated & dead code. 2013-11-08 22:40:33 +00:00
ng_pipe.h Start copyright notice with /*- 2010-04-07 16:29:10 +00:00
ng_ppp.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_ppp.h Add 64bit statistic counters to the ng_ppp node. 2007-08-01 20:49:35 +00:00
ng_pppoe.c Add constant for PPP-Max-PayLoad tag. 2013-07-23 10:25:34 +00:00
ng_pppoe.h Add constant for PPP-Max-PayLoad tag. 2013-07-23 10:25:34 +00:00
ng_pptpgre.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_pptpgre.h Rewrite node to support multiple hooks, alike to ng_l2tp, to use one pair 2008-03-24 22:55:22 +00:00
ng_pred1.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_pred1.h A node that implements Predictor-1 compression for PPP. 2006-12-29 09:54:32 +00:00
ng_rfc1490.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_rfc1490.h
ng_sample.c Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
ng_sample.h
ng_socket.c In ng_getsockaddr() allocate memory prior to obtaining lock. 2012-02-16 14:44:52 +00:00
ng_socket.h Make the sg_len and sg_family members of the sockaddr_ng the same type 2006-10-17 11:03:55 +00:00
ng_socketvar.h In ng_socket(4) expose less kernel internals to userland. This commit 2012-01-23 15:39:45 +00:00
ng_source.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_source.h Remove defunct email address from header as well. 2010-07-06 16:55:39 +00:00
ng_split.c Node constructor methods are supposed to be called in syscall 2011-04-18 09:12:27 +00:00
ng_split.h
ng_sppp.c The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare 2013-10-26 17:58:36 +00:00
ng_sppp.h
ng_tag.c The newhook method can be called in ISR context at 2012-01-17 18:10:25 +00:00
ng_tag.h A netgraph node that can do different manipulations with 2006-06-27 12:45:28 +00:00
ng_tcpmss.c Remove alignment constraints. 2010-04-01 10:41:01 +00:00
ng_tcpmss.h
ng_tee.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_tee.h
ng_tty.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_tty.h Assign new cookie to the node to reflect API change. 2008-11-08 02:05:41 +00:00
ng_UI.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_UI.h
ng_vjc.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_vjc.h
ng_vlan.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_vlan.h Upgrade the netgraph vlan node to support 802.1q, encapsulation type, 2012-03-11 19:08:56 +00:00
NOTES Spell DIAGNOSTIC correctly. 2009-10-24 18:49:17 +00:00