NG_CISCO(4)

πŸ’– NG_CISCO(4) πŸ’–

okay bestie, gather round, because we're about to talk about ng_cisco β€” the Cisco HDLC protocol netgraph node type, straight out of the Kernel Interfaces Manual. this is a real one. no cap. πŸ¦‹


✨ SYNOPSIS ✨

like all the cool kids, you gotta include the headers first:

#include <sys/types.h>
#include <netinet/in.h>
#include <netgraph/ng_cisco.h>

🌸 DESCRIPTION 🌸

so the cisco node type does encapsulation and de-encapsulation of packets using the Cisco HDLC protocol. it's a pretty simple protocol for sending packets across high speed synchronous lines. every single packet gets an Ethertype prepended to it, which tells you what protocol it is. and yes, there's also a "keep alive" capability and an "inquire" capability. the way that it does all three? iconic. πŸ‘‘

the downstream hook is the one that should connect to the synchronous line. on the other side of the node you've got the inet, inet6, atalk, and ipx hooks, which transmit and receive raw IP, IPv6, AppleTalk, and IPX packets respectively. typically these hooks would connect to the corresponding hooks on an ng_iface(4) type node. matching hooks to matching hooks? it's giving soulmates fr fr πŸ’ž


πŸŽ€ IP Configuration πŸŽ€

so for IP traffic to actually function properly, the node has to be informed of the local IP address and netmask setting. why, you ask? because the protocol includes an "inquire" packet, and we must be prepared to answer it. rude of the protocol to ask, but okay. there are two ways to accomplish this: manually and automatically. pick your fighter. πŸ’…

whenever such an inquire packet is received, the node sends a NGM_CISCO_GET_IPADDR control message to the peer node connected to the inet hook (if any). if the peer responds, then that response is used. that's the automatic method. so easy. so slay. ✨

if the peer does not respond, the node falls back on its cached value for the IP address and netmask. this cached value can be set at any time with a NGM_CISCO_SET_IPADDR message, and that's the manual method. sometimes you just gotta do it yourself, and that's valid. 🫢

and if the inet hook is connected to the inet hook of an ng_iface(4) node β€” which, ngl, is usually the case β€” then configuration is automatic, because ng_iface(4) understands the NGM_CISCO_GET_IPADDR message. bestie behavior. it just gets you. 😭


πŸ¦‹ HOOKS πŸ¦‹

this node type supports the following hooks:

  • downstream β€” the connection to the synchronous line. the main character of the hook lineup. 🌈
  • inet β€” IP hook.
  • inet6 β€” IPv6 hook.
  • atalk β€” AppleTalk hook.
  • ipx β€” IPX hook.

πŸ”₯ CONTROL MESSAGES πŸ”₯

this node type supports the generic control messages, plus the following:

  • NGM_CISCO_SET_IPADDR (setipaddr) β€” this command takes an array of two struct in_addr arguments. the first is the IP address of the corresponding interface and the second is the netmask. two args, one job. πŸ’…
  • NGM_CISCO_GET_IPADDR (getipaddr) β€” this command returns the IP configuration in the same format used by NGM_CISCO_SET_IPADDR. this command is also sent by this node type to the inet peer whenever an IP address inquiry packet is received. so it's a receiver AND a sender. versatile queen. πŸ‘‘
  • NGM_CISCO_GET_STATUS (getstats) β€” returns a struct ngciscostat:
struct ngciscostat {
  uint32_t   seqRetries;        /* # unack'd retries */
  uint32_t   keepAlivePeriod;   /* in seconds */
};

look at those fields. seqRetries is the number of unack'd retries and keepAlivePeriod is in seconds. we love a stats struct with comments. 🌸


πŸ’€ SHUTDOWN πŸ’€

this node shuts down upon receipt of a NGM_SHUTDOWN control message, or when all hooks have been disconnected. it's like when the group chat goes quiet and everyone just... leaves. 😭 but that's the protocol, bestie.


🌈 SEE ALSO 🌈

go read them. iykyk. πŸ“šβœ¨


Cisco is a trademark of Cisco Systems, Inc. okay so legally we have to say that. consider it said. πŸ’œ


πŸŽ€ HISTORY πŸŽ€

The ng_cisco node type was implemented in FreeBSD 4.0. vintage. retro. historic, even. 🌸


πŸ‘‘ AUTHORS πŸ‘‘

  • Julian Elischer <julian@FreeBSD.org>
  • Archie Cobbs <archie@FreeBSD.org>

absolute legends, both of them. 🫢


πŸ› BUGS πŸ›

not all of the functionality has been implemented. for example, the node does not support querying the remote end for its IP address and netmask.

so yeah, that part? not done. no cap, don't go looking for it. πŸ™ˆ


and that's the whole page, bestie β€” this one came from the Debian crew and it's dated January 19, 1999, which is lowkey ancient but we love it anyway. mwah. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from