netgraph TTY

Jerry Toung jtoung at arc.nasa.gov
Wed Mar 30 16:21:51 PST 2005


Good afternoon list,
I am still trying to build a simple netgraph using ng_tty. Ultimately I would 
like to go from inet->tee->ng_tty(/dev/cuaa0).

Please advise what I am doing wrong as I still see an error message (see 
bottom of email). Excuse me for the slighty long thread.

Here is my very simple line discipline code:

        int d;
        int ldisc;
        ldisc = NETGRAPHDISC;

        
        if ((d = open("/dev/cuaa0", O_RDWR)) == -1) {
                perror("open");
        } else {
            printf("descripto # %d\n", d);
            if ((ioctl(d, TIOCSETD, &ldisc)) == -1) {
                perror("ioctl");
            }
        }
        printf("Netgraph TTY node initialized successfully\nPress any key to 
destroy it");
        getc(stdin);
        close(d);
        exit;


mrcrab# gcc -g netgraph.c -o test
mrcrab# ./test
descripto # 3
Netgraph TTY node initialized successfully
Press any key to destroy it

+ list
There are 2 total nodes:
  Name: ngctl27022      Type: socket          ID: 0000000a   Num hooks: 0
  Name: tty1            Type: tty             ID: 00000008   Num hooks: 0
+ mpeer . tee myhook right
ngctl: "mpeer": unknown command
+ mkpeer . tee myhook right
+ name .:myhook mytee
+ mkpeer mytee: tty left hook
ngctl: send msg: Operation not permitted
+




More information about the freebsd-hackers mailing list