linux/drivers/net/ppp
Guillaume Nault 84bef5b603 pptp: Fix fib lookup calls.
PPTP uses pppox sockets (struct pppox_sock). These sockets don't embed
an inet_sock structure, so it's invalid to call inet_sk() on them.

Therefore, the ip_route_output_ports() call in pptp_connect() has two
problems:

  * The tos variable is set with RT_CONN_FLAGS(sk), which calls
    inet_sk() on the pppox socket.

  * ip_route_output_ports() tries to retrieve routing flags using
    inet_sk_flowi_flags(), which is also going to call inet_sk() on the
    pppox socket.

While PPTP doesn't use inet sockets, it's actually really layered on
top of IP and therefore needs a proper way to do fib lookups. So let's
define pptp_route_output() to get a struct rtable from a pptp socket.
Let's also replace the ip_route_output_ports() call of pptp_xmit() for
consistency.

In practice, this means that:

  * pptp_connect() sets ->flowi4_tos and ->flowi4_flags to zero instead
    of using bits of unrelated struct pppox_sock fields.

  * pptp_xmit() now respects ->sk_mark and ->sk_uid.

  * pptp_xmit() now calls the security_sk_classify_flow() security
    hook, thus allowing to set ->flowic_secid.

  * pptp_xmit() now passes the pppox socket to xfrm_lookup_route().

Found by code inspection.

Fixes: 00959ade36 ("PPTP: PPP over IPv4 (Point-to-Point Tunneling Protocol)")
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-07-04 19:39:30 +01:00
..
bsd_comp.c net: ppp: remove leading spaces before tabs 2021-05-20 15:10:57 -07:00
Kconfig net/pppoe: fix a typo for the PPPOE_HASH_BITS_1 definition 2023-06-06 13:28:30 +02:00
Makefile
ppp_async.c tty: remove file from tty_ldisc_ops::ioctl and compat_ioctl 2021-11-25 18:36:27 +01:00
ppp_deflate.c ppp: deflate: Remove useless call "zlib_inflateEnd" 2021-03-30 16:59:30 -07:00
ppp_generic.c driver core: class: remove module * from class_create() 2023-03-17 15:16:33 +01:00
ppp_mppe.c
ppp_mppe.h
ppp_synctty.c tty: remove file from tty_ldisc_ops::ioctl and compat_ioctl 2021-11-25 18:36:27 +01:00
pppoe.c net/pppoe: make number of hash bits configurable 2023-05-17 13:03:45 +01:00
pppox.c
pptp.c pptp: Fix fib lookup calls. 2023-07-04 19:39:30 +01:00