- ppp_kick_tty (ppp, ppp->tbuf);
- return ((int) count);
-}
-
-/*
- * Process the IOCTL event for the tty device.
- */
-
-static int
-ppp_tty_ioctl (struct tty_struct *tty, struct file *file, unsigned int param2,
- unsigned long param3)
-{
- struct ppp *ppp = (struct ppp *) tty->disc_data;
- register int temp_i = 0;
- int error;
-/*
- * Verify the status of the PPP device.
- */
- if (!ppp || ppp->magic != PPP_MAGIC) {
- PRINTK ((KERN_ERR
- "ppp_tty_ioctl: can't find PPP block from tty!\n"));
- return -EBADF;
- }
- CHECK_PPP (-ENXIO);
-/*
- * The user must have an euid of root to do these requests.
- */
- if (!suser ()) {
- return -EPERM;
- }
-/*
- * Set the MRU value
- */
- switch (param2) {
- case PPPIOCSMRU:
- error = verify_area (VERIFY_READ, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: set mru to %x\n", temp_i));
- temp_i = (int) get_fs_long (param3);
- if (ppp->mru != temp_i) {
- ppp_changedmtu (ppp, ppp->dev->mtu, temp_i);
- }
- }
- break;
-/*
- * Fetch the flags
- */
- case PPPIOCGFLAGS:
- error = verify_area (VERIFY_WRITE, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- temp_i = (ppp->flags & SC_MASK);
-#ifndef CHECK_CHARACTERS /* Don't generate errors if we don't check chars. */
- temp_i |= SC_RCV_B7_1 | SC_RCV_B7_0 |
- SC_RCV_ODDP | SC_RCV_EVNP;
-#endif
- put_fs_long ((long) temp_i, param3);
- PRINTKN (3, (KERN_DEBUG
- "ppp_tty_ioctl: get flags: addr %lx flags %x\n",
- param3, temp_i));
- }
- break;
-/*
- * Set the flags for the various options
- */
- case PPPIOCSFLAGS:
- error = verify_area (VERIFY_READ, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- temp_i = (int) get_fs_long (param3);
- ppp->flags ^= ((ppp->flags ^ temp_i) & SC_MASK);
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: set flags to %x\n", temp_i));
- }
- break;
-/*
- * Retrieve the transmit async map
- */
- case PPPIOCGASYNCMAP:
- error = verify_area (VERIFY_WRITE, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- put_fs_long (ppp->xmit_async_map[0], param3);
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: get asyncmap: addr %lx asyncmap %lx\n",
- param3, ppp->xmit_async_map[0]));
- }
- break;
-/*
- * Set the transmit async map
- */
- case PPPIOCSASYNCMAP:
- error = verify_area (VERIFY_READ, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- ppp->xmit_async_map[0] = get_fs_long (param3);
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: set xmit asyncmap %lx\n",
- ppp->xmit_async_map[0]));
- }
- break;
-/*
- * Set the receive async map
- */
- case PPPIOCSRASYNCMAP:
- error = verify_area (VERIFY_READ, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- ppp->recv_async_map = get_fs_long (param3);
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: set rcv asyncmap %lx\n",
- ppp->recv_async_map));
- }
- break;
-/*
- * Obtain the unit number for this device.
- */
- case PPPIOCGUNIT:
- error = verify_area (VERIFY_WRITE, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- put_fs_long (ppp->dev->base_addr, param3);
- PRINTKN (3,
- (KERN_INFO "ppp_tty_ioctl: get unit: %d",
- ppp->dev->base_addr));
- }
- break;
-/*
- * Set the debug level
- */
- case PPPIOCSDEBUG:
- error = verify_area (VERIFY_READ, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- ppp_debug = (int) get_fs_long (param3);
- ppp_debug_netpackets = (ppp_debug & 0xff00) >> 8;
- ppp_debug &= 0xff;
- PRINTKN (1, (KERN_INFO
- "ppp_tty_ioctl: set debug level %d, netpacket %d\n",
- ppp_debug, ppp_debug_netpackets));
- }
- break;
-/*
- * Get the debug level
- */
- case PPPIOCGDEBUG:
- error = verify_area (VERIFY_WRITE, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- put_fs_long ((long) (ppp_debug |
- (ppp_debug_netpackets << 8)),
- param3);
-
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: get debug level %d\n",
- ppp_debug | (ppp_debug_netpackets << 8)));
- }
- break;
-/*
- * Get the times since the last send/receive frame operation
- */
- case PPPIOCGTIME:
- error = verify_area (VERIFY_WRITE, (void *) param3,
- sizeof (struct ppp_ddinfo));
- if (error == 0) {
- struct ppp_ddinfo cur_ddinfo;
- unsigned long cur_jiffies = jiffies;
-
- /* change absolute times to relative times. */
- cur_ddinfo.ip_sjiffies = cur_jiffies - ppp->ddinfo.ip_sjiffies;
- cur_ddinfo.ip_rjiffies = cur_jiffies - ppp->ddinfo.ip_rjiffies;
- cur_ddinfo.nip_sjiffies = cur_jiffies - ppp->ddinfo.nip_sjiffies;
- cur_ddinfo.nip_rjiffies = cur_jiffies - ppp->ddinfo.nip_rjiffies;
-
- memcpy_tofs ((void *) param3, &cur_ddinfo,
- sizeof (struct ppp_ddinfo));
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: read demand dial info\n"));
- }
- break;
-/*
- * Retrieve the extended async map
- */
- case PPPIOCGXASYNCMAP:
- error = verify_area (VERIFY_WRITE,
- (void *) param3,
- sizeof (ppp->xmit_async_map));
- if (error == 0) {
- memcpy_tofs ((void *) param3,
- ppp->xmit_async_map,
- sizeof (ppp->xmit_async_map));
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: get xasyncmap: addr %lx\n",
- param3));
- }
- break;
-/*
- * Set the async extended map
- */
- case PPPIOCSXASYNCMAP:
- error = verify_area (VERIFY_READ, (void *) param3,
- sizeof (ppp->xmit_async_map));
- if (error == 0) {
- unsigned long temp_tbl[8];
-
- memcpy_fromfs (temp_tbl, (void *) param3,
- sizeof (ppp->xmit_async_map));
- temp_tbl[1] = 0x00000000;
- temp_tbl[2] &= ~0x40000000;
- temp_tbl[3] |= 0x60000000;