NG_MPPC(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ‘‘ NG_MPPC β€” the Microsoft MPPC/MPPE compression + encryption netgraph node type, bestie

okay so this is NG_MPPC(4) from the Kernel Interfaces Manual and honestly it's giving "niche but essential" energy ✨ β€” it's the netgraph node type that does Microsoft's Point-to-Point Compression and Encryption. iykyk.


✨ SYNOPSIS ✨

#include <sys/types.h>
#include <netgraph/ng_mppc.h>

🌸 DESCRIPTION 🌸

the mppc node type implements the Microsoft Point-to-Point Compression (MPPC) and Microsoft Point-to-Point Encryption (MPPE) sub-protocols of the PPP protocol, fr fr. and like, these protocols are so often used together with the Point-to-Point Tunneling Protocol (PPTP) β€” they're basically a trio at this point πŸ’….

so the node has two hooks: comp for compression and decomp for decompression. typically one or both of these hooks would be connected to the ng_ppp(4) node type hook of the same name β€” matching names, cute, iconic πŸŽ€. and each direction of traffic flow is independent of the other, no cap. they don't talk to each other, they just vibe separately ✨.


πŸ¦‹ HOOKS πŸ¦‹

this node type supports the following hooks, bestie:

  • comp β€” connection to the ng_ppp(4) comp hook. incoming frames are compressed and/or encrypted, and sent back out the same hook πŸ”₯.
  • decomp β€” connection to the ng_ppp(4) decomp hook. incoming frames are decompressed and/or decrypted, and sent back out the same hook πŸ”₯.

πŸ’œ CONTROL MESSAGES πŸ’œ

this node type supports the generic control messages plus these following ones β€” get comfy, there's a whole struct coming 🫢:

  • NGM_MPPC_CONFIG_COMP β€” this command resets and configures the node for a session in the outgoing traffic direction (i.e., for compression and/or encryption). this command takes a struct ng_mppc_config as an argument:
/* Length of MPPE key */
#define MPPE_KEY_LEN      16

/* MPPC/MPPE PPP negotiation bits */
#define MPPC_BIT          0x00000001      /* mppc compression bits */
#define MPPE_40           0x00000020      /* use 40 bit key */
#define MPPE_56           0x00000080      /* use 56 bit key */
#define MPPE_128          0x00000040      /* use 128 bit key */
#define MPPE_BITS         0x000000e0      /* mppe encryption bits */
#define MPPE_STATELESS    0x01000000      /* use stateless mode */
#define MPPC_VALID_BITS   0x010000e1      /* possibly valid bits */

/* Configuration for a session */
struct ng_mppc_config {
    u_char    enable;                 /* enable */
    uint32_t  bits;                   /* config bits */
    u_char    startkey[MPPE_KEY_LEN]; /* start key */
};

the enabled field enables traffic flow through the node 🚦. the bits field contains the bits as negotiated by the Compression Control Protocol (CCP) in PPP. and the startkey is only necessary if MPPE was negotiated, and it must be equal to the session start key as defined for MPPE β€” that key is based on the MS-CHAP credentials used at link authentication time πŸ”. so don't just make one up, mkkay?

  • NGM_MPPC_CONFIG_DECOMP β€” this command resets and configures the node for a session in the incoming traffic direction (i.e., for decompression and/or decryption). this command takes a struct ng_mppc_config as an argument. same struct, opposite direction, slay πŸ’….
  • NGM_MPPC_RESETREQ β€” this message contains no arguments, and is bi-directional, periodt. if an error is detected during decompression, this message is sent by the node to the originator of the NGM_MPPC_CONFIG_DECOMP message that initiated the session 😭. the receiver should respond by sending a PPP CCP Reset-Request to the peer.

this message may also be received by this node type when a CCP Reset-Request is received by the local PPP entity. the node will respond by flushing its outgoing compression and encryption state so the remote side can resynchronize πŸ”„. iconic resync behavior ngl.


πŸŽ€ SHUTDOWN πŸŽ€

this node shuts down upon receipt of a NGM_SHUTDOWN control message, or when both hooks have been disconnected πŸ’€. that's it. two ways out. main character exit energy.


⭐ COMPILATION ⭐

the kernel options NETGRAPH_MPPC_COMPRESSION and NETGRAPH_MPPC_ENCRYPTION are supplied to selectively compile in either or both capabilities πŸ› οΈ.

ok so real talk: at least one of these must be defined, or else this node type is useless πŸ™ˆ. like literally useless. zero purpose. so don't forget, bestie.

🌈 SEE ALSO 🌈

  • netgraph(4), ng_ppp(4), ngctl(8)
  • G. Pall, Microsoft Point-To-Point Compression (MPPC) Protocol, RFC 2118.
  • G. S. Pall and G. Zorn, Microsoft Point-To-Point Encryption (MPPE) Protocol, draft-ietf-pppext-mppe-04.txt.
  • K. Hamzeh, G. Pall, W. Verthein, J. Taarud, W. Little, and G. Zorn, Point-to-Point Tunneling Protocol (PPTP), RFC 2637.

πŸ‘‘ AUTHORS πŸ‘‘

Archie Cobbs <archie@FreeBSD.org> β€” the whole entire legend who wrote this πŸ’–


πŸ’€ BUGS πŸ’€

not me having to say this but: in PPP, encryption should be handled by the Encryption Control Protocol (ECP) rather than CCP 😭. however, Microsoft combined both compression and encryption into their "compression" algorithm, which is confusing. and that's just... the way it is. we live in their world 🫢. no cap, it's genuinely confusing, not just you.


✨ that's the whole page babes ✨ β€” Debian, June 7, 2016, from the Kernel Interfaces Manual, NG_MPPC(4). go forth and tunnel responsibly πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from