aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet
diff options
context:
space:
mode:
Diffstat (limited to 'net/decnet')
-rw-r--r--net/decnet/af_decnet.c697
-rw-r--r--net/decnet/dn_dev.c78
-rw-r--r--net/decnet/dn_fib.c81
-rw-r--r--net/decnet/dn_neigh.c42
-rw-r--r--net/decnet/dn_nsp_in.c182
-rw-r--r--net/decnet/dn_route.c143
-rw-r--r--net/decnet/dn_table.c23
-rw-r--r--net/decnet/netfilter/dn_rtmsg.c18
-rw-r--r--net/decnet/sysctl_net_decnet.c17
9 files changed, 646 insertions, 635 deletions
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index ea3b6ee21fc9..19acd00a6382 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -291,23 +291,23 @@ int dn_sockaddr2username(struct sockaddr_dn *sdn, unsigned char *buf, unsigned c
291 291
292 *buf++ = type; 292 *buf++ = type;
293 293
294 switch(type) { 294 switch (type) {
295 case 0: 295 case 0:
296 *buf++ = sdn->sdn_objnum; 296 *buf++ = sdn->sdn_objnum;
297 break; 297 break;
298 case 1: 298 case 1:
299 *buf++ = 0; 299 *buf++ = 0;
300 *buf++ = le16_to_cpu(sdn->sdn_objnamel); 300 *buf++ = le16_to_cpu(sdn->sdn_objnamel);
301 memcpy(buf, sdn->sdn_objname, le16_to_cpu(sdn->sdn_objnamel)); 301 memcpy(buf, sdn->sdn_objname, le16_to_cpu(sdn->sdn_objnamel));
302 len = 3 + le16_to_cpu(sdn->sdn_objnamel); 302 len = 3 + le16_to_cpu(sdn->sdn_objnamel);
303 break; 303 break;
304 case 2: 304 case 2:
305 memset(buf, 0, 5); 305 memset(buf, 0, 5);
306 buf += 5; 306 buf += 5;
307 *buf++ = le16_to_cpu(sdn->sdn_objnamel); 307 *buf++ = le16_to_cpu(sdn->sdn_objnamel);
308 memcpy(buf, sdn->sdn_objname, le16_to_cpu(sdn->sdn_objnamel)); 308 memcpy(buf, sdn->sdn_objname, le16_to_cpu(sdn->sdn_objnamel));
309 len = 7 + le16_to_cpu(sdn->sdn_objnamel); 309 len = 7 + le16_to_cpu(sdn->sdn_objnamel);
310 break; 310 break;
311 } 311 }
312 312
313 return len; 313 return len;
@@ -337,23 +337,23 @@ int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *sdn,
337 *fmt = *data++; 337 *fmt = *data++;
338 type = *data++; 338 type = *data++;
339 339
340 switch(*fmt) { 340 switch (*fmt) {
341 case 0: 341 case 0:
342 sdn->sdn_objnum = type; 342 sdn->sdn_objnum = type;
343 return 2; 343 return 2;
344 case 1: 344 case 1:
345 namel = 16; 345 namel = 16;
346 break; 346 break;
347 case 2: 347 case 2:
348 len -= 4; 348 len -= 4;
349 data += 4; 349 data += 4;
350 break; 350 break;
351 case 4: 351 case 4:
352 len -= 8; 352 len -= 8;
353 data += 8; 353 data += 8;
354 break; 354 break;
355 default: 355 default:
356 return -1; 356 return -1;
357 } 357 }
358 358
359 len -= 1; 359 len -= 1;
@@ -575,25 +575,26 @@ int dn_destroy_timer(struct sock *sk)
575 575
576 scp->persist = dn_nsp_persist(sk); 576 scp->persist = dn_nsp_persist(sk);
577 577
578 switch(scp->state) { 578 switch (scp->state) {
579 case DN_DI: 579 case DN_DI:
580 dn_nsp_send_disc(sk, NSP_DISCINIT, 0, GFP_ATOMIC); 580 dn_nsp_send_disc(sk, NSP_DISCINIT, 0, GFP_ATOMIC);
581 if (scp->nsp_rxtshift >= decnet_di_count) 581 if (scp->nsp_rxtshift >= decnet_di_count)
582 scp->state = DN_CN; 582 scp->state = DN_CN;
583 return 0; 583 return 0;
584 584
585 case DN_DR: 585 case DN_DR:
586 dn_nsp_send_disc(sk, NSP_DISCINIT, 0, GFP_ATOMIC); 586 dn_nsp_send_disc(sk, NSP_DISCINIT, 0, GFP_ATOMIC);
587 if (scp->nsp_rxtshift >= decnet_dr_count) 587 if (scp->nsp_rxtshift >= decnet_dr_count)
588 scp->state = DN_DRC; 588 scp->state = DN_DRC;
589 return 0; 589 return 0;
590 590
591 case DN_DN: 591 case DN_DN:
592 if (scp->nsp_rxtshift < decnet_dn_count) { 592 if (scp->nsp_rxtshift < decnet_dn_count) {
593 /* printk(KERN_DEBUG "dn_destroy_timer: DN\n"); */ 593 /* printk(KERN_DEBUG "dn_destroy_timer: DN\n"); */
594 dn_nsp_send_disc(sk, NSP_DISCCONF, NSP_REASON_DC, GFP_ATOMIC); 594 dn_nsp_send_disc(sk, NSP_DISCCONF, NSP_REASON_DC,
595 return 0; 595 GFP_ATOMIC);
596 } 596 return 0;
597 }
597 } 598 }
598 599
599 scp->persist = (HZ * decnet_time_wait); 600 scp->persist = (HZ * decnet_time_wait);
@@ -623,42 +624,42 @@ static void dn_destroy_sock(struct sock *sk)
623 624
624 sk->sk_state = TCP_CLOSE; 625 sk->sk_state = TCP_CLOSE;
625 626
626 switch(scp->state) { 627 switch (scp->state) {
627 case DN_DN: 628 case DN_DN:
628 dn_nsp_send_disc(sk, NSP_DISCCONF, NSP_REASON_DC, 629 dn_nsp_send_disc(sk, NSP_DISCCONF, NSP_REASON_DC,
629 sk->sk_allocation); 630 sk->sk_allocation);
630 scp->persist_fxn = dn_destroy_timer; 631 scp->persist_fxn = dn_destroy_timer;
631 scp->persist = dn_nsp_persist(sk); 632 scp->persist = dn_nsp_persist(sk);
632 break; 633 break;
633 case DN_CR: 634 case DN_CR:
634 scp->state = DN_DR; 635 scp->state = DN_DR;
635 goto disc_reject; 636 goto disc_reject;
636 case DN_RUN: 637 case DN_RUN:
637 scp->state = DN_DI; 638 scp->state = DN_DI;
638 case DN_DI: 639 case DN_DI:
639 case DN_DR: 640 case DN_DR:
640disc_reject: 641disc_reject:
641 dn_nsp_send_disc(sk, NSP_DISCINIT, 0, sk->sk_allocation); 642 dn_nsp_send_disc(sk, NSP_DISCINIT, 0, sk->sk_allocation);
642 case DN_NC: 643 case DN_NC:
643 case DN_NR: 644 case DN_NR:
644 case DN_RJ: 645 case DN_RJ:
645 case DN_DIC: 646 case DN_DIC:
646 case DN_CN: 647 case DN_CN:
647 case DN_DRC: 648 case DN_DRC:
648 case DN_CI: 649 case DN_CI:
649 case DN_CD: 650 case DN_CD:
650 scp->persist_fxn = dn_destroy_timer; 651 scp->persist_fxn = dn_destroy_timer;
651 scp->persist = dn_nsp_persist(sk); 652 scp->persist = dn_nsp_persist(sk);
652 break; 653 break;
653 default: 654 default:
654 printk(KERN_DEBUG "DECnet: dn_destroy_sock passed socket in invalid state\n"); 655 printk(KERN_DEBUG "DECnet: dn_destroy_sock passed socket in invalid state\n");
655 case DN_O: 656 case DN_O:
656 dn_stop_slow_timer(sk); 657 dn_stop_slow_timer(sk);
657 658
658 dn_unhash_sock_bh(sk); 659 dn_unhash_sock_bh(sk);
659 sock_put(sk); 660 sock_put(sk);
660 661
661 break; 662 break;
662 } 663 }
663} 664}
664 665
@@ -683,15 +684,15 @@ static int dn_create(struct net *net, struct socket *sock, int protocol,
683 if (!net_eq(net, &init_net)) 684 if (!net_eq(net, &init_net))
684 return -EAFNOSUPPORT; 685 return -EAFNOSUPPORT;
685 686
686 switch(sock->type) { 687 switch (sock->type) {
687 case SOCK_SEQPACKET: 688 case SOCK_SEQPACKET:
688 if (protocol != DNPROTO_NSP) 689 if (protocol != DNPROTO_NSP)
689 return -EPROTONOSUPPORT; 690 return -EPROTONOSUPPORT;
690 break; 691 break;
691 case SOCK_STREAM: 692 case SOCK_STREAM:
692 break; 693 break;
693 default: 694 default:
694 return -ESOCKTNOSUPPORT; 695 return -ESOCKTNOSUPPORT;
695 } 696 }
696 697
697 698
@@ -987,16 +988,16 @@ static inline int dn_check_state(struct sock *sk, struct sockaddr_dn *addr, int
987{ 988{
988 struct dn_scp *scp = DN_SK(sk); 989 struct dn_scp *scp = DN_SK(sk);
989 990
990 switch(scp->state) { 991 switch (scp->state) {
991 case DN_RUN: 992 case DN_RUN:
992 return 0; 993 return 0;
993 case DN_CR: 994 case DN_CR:
994 return dn_confirm_accept(sk, timeo, sk->sk_allocation); 995 return dn_confirm_accept(sk, timeo, sk->sk_allocation);
995 case DN_CI: 996 case DN_CI:
996 case DN_CC: 997 case DN_CC:
997 return dn_wait_run(sk, timeo); 998 return dn_wait_run(sk, timeo);
998 case DN_O: 999 case DN_O:
999 return __dn_connect(sk, addr, addrlen, timeo, flags); 1000 return __dn_connect(sk, addr, addrlen, timeo, flags);
1000 } 1001 }
1001 1002
1002 return -EINVAL; 1003 return -EINVAL;
@@ -1363,141 +1364,140 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us
1363 if (copy_from_user(&u, optval, optlen)) 1364 if (copy_from_user(&u, optval, optlen))
1364 return -EFAULT; 1365 return -EFAULT;
1365 1366
1366 switch(optname) { 1367 switch (optname) {
1367 case DSO_CONDATA: 1368 case DSO_CONDATA:
1368 if (sock->state == SS_CONNECTED) 1369 if (sock->state == SS_CONNECTED)
1369 return -EISCONN; 1370 return -EISCONN;
1370 if ((scp->state != DN_O) && (scp->state != DN_CR)) 1371 if ((scp->state != DN_O) && (scp->state != DN_CR))
1371 return -EINVAL; 1372 return -EINVAL;
1372 1373
1373 if (optlen != sizeof(struct optdata_dn)) 1374 if (optlen != sizeof(struct optdata_dn))
1374 return -EINVAL; 1375 return -EINVAL;
1375 1376
1376 if (le16_to_cpu(u.opt.opt_optl) > 16) 1377 if (le16_to_cpu(u.opt.opt_optl) > 16)
1377 return -EINVAL; 1378 return -EINVAL;
1378 1379
1379 memcpy(&scp->conndata_out, &u.opt, optlen); 1380 memcpy(&scp->conndata_out, &u.opt, optlen);
1380 break; 1381 break;
1381
1382 case DSO_DISDATA:
1383 if (sock->state != SS_CONNECTED && scp->accept_mode == ACC_IMMED)
1384 return -ENOTCONN;
1385
1386 if (optlen != sizeof(struct optdata_dn))
1387 return -EINVAL;
1388 1382
1389 if (le16_to_cpu(u.opt.opt_optl) > 16) 1383 case DSO_DISDATA:
1390 return -EINVAL; 1384 if (sock->state != SS_CONNECTED &&
1385 scp->accept_mode == ACC_IMMED)
1386 return -ENOTCONN;
1391 1387
1392 memcpy(&scp->discdata_out, &u.opt, optlen); 1388 if (optlen != sizeof(struct optdata_dn))
1393 break; 1389 return -EINVAL;
1394 1390
1395 case DSO_CONACCESS: 1391 if (le16_to_cpu(u.opt.opt_optl) > 16)
1396 if (sock->state == SS_CONNECTED) 1392 return -EINVAL;
1397 return -EISCONN;
1398 if (scp->state != DN_O)
1399 return -EINVAL;
1400 1393
1401 if (optlen != sizeof(struct accessdata_dn)) 1394 memcpy(&scp->discdata_out, &u.opt, optlen);
1402 return -EINVAL; 1395 break;
1403 1396
1404 if ((u.acc.acc_accl > DN_MAXACCL) || 1397 case DSO_CONACCESS:
1405 (u.acc.acc_passl > DN_MAXACCL) || 1398 if (sock->state == SS_CONNECTED)
1406 (u.acc.acc_userl > DN_MAXACCL)) 1399 return -EISCONN;
1407 return -EINVAL; 1400 if (scp->state != DN_O)
1401 return -EINVAL;
1408 1402
1409 memcpy(&scp->accessdata, &u.acc, optlen); 1403 if (optlen != sizeof(struct accessdata_dn))
1410 break; 1404 return -EINVAL;
1411 1405
1412 case DSO_ACCEPTMODE: 1406 if ((u.acc.acc_accl > DN_MAXACCL) ||
1413 if (sock->state == SS_CONNECTED) 1407 (u.acc.acc_passl > DN_MAXACCL) ||
1414 return -EISCONN; 1408 (u.acc.acc_userl > DN_MAXACCL))
1415 if (scp->state != DN_O) 1409 return -EINVAL;
1416 return -EINVAL;
1417 1410
1418 if (optlen != sizeof(int)) 1411 memcpy(&scp->accessdata, &u.acc, optlen);
1419 return -EINVAL; 1412 break;
1420 1413
1421 if ((u.mode != ACC_IMMED) && (u.mode != ACC_DEFER)) 1414 case DSO_ACCEPTMODE:
1422 return -EINVAL; 1415 if (sock->state == SS_CONNECTED)
1416 return -EISCONN;
1417 if (scp->state != DN_O)
1418 return -EINVAL;
1423 1419
1424 scp->accept_mode = (unsigned char)u.mode; 1420 if (optlen != sizeof(int))
1425 break; 1421 return -EINVAL;
1426 1422
1427 case DSO_CONACCEPT: 1423 if ((u.mode != ACC_IMMED) && (u.mode != ACC_DEFER))
1424 return -EINVAL;
1428 1425
1429 if (scp->state != DN_CR) 1426 scp->accept_mode = (unsigned char)u.mode;
1430 return -EINVAL; 1427 break;
1431 timeo = sock_rcvtimeo(sk, 0);
1432 err = dn_confirm_accept(sk, &timeo, sk->sk_allocation);
1433 return err;
1434 1428
1435 case DSO_CONREJECT: 1429 case DSO_CONACCEPT:
1430 if (scp->state != DN_CR)
1431 return -EINVAL;
1432 timeo = sock_rcvtimeo(sk, 0);
1433 err = dn_confirm_accept(sk, &timeo, sk->sk_allocation);
1434 return err;
1436 1435
1437 if (scp->state != DN_CR) 1436 case DSO_CONREJECT:
1438 return -EINVAL; 1437 if (scp->state != DN_CR)
1438 return -EINVAL;
1439 1439
1440 scp->state = DN_DR; 1440 scp->state = DN_DR;
1441 sk->sk_shutdown = SHUTDOWN_MASK; 1441 sk->sk_shutdown = SHUTDOWN_MASK;
1442 dn_nsp_send_disc(sk, 0x38, 0, sk->sk_allocation); 1442 dn_nsp_send_disc(sk, 0x38, 0, sk->sk_allocation);
1443 break; 1443 break;
1444 1444
1445 default: 1445 default:
1446#ifdef CONFIG_NETFILTER 1446#ifdef CONFIG_NETFILTER
1447 return nf_setsockopt(sk, PF_DECnet, optname, optval, optlen); 1447 return nf_setsockopt(sk, PF_DECnet, optname, optval, optlen);
1448#endif 1448#endif
1449 case DSO_LINKINFO: 1449 case DSO_LINKINFO:
1450 case DSO_STREAM: 1450 case DSO_STREAM:
1451 case DSO_SEQPACKET: 1451 case DSO_SEQPACKET:
1452 return -ENOPROTOOPT; 1452 return -ENOPROTOOPT;
1453 1453
1454 case DSO_MAXWINDOW: 1454 case DSO_MAXWINDOW:
1455 if (optlen != sizeof(unsigned long)) 1455 if (optlen != sizeof(unsigned long))
1456 return -EINVAL; 1456 return -EINVAL;
1457 if (u.win > NSP_MAX_WINDOW) 1457 if (u.win > NSP_MAX_WINDOW)
1458 u.win = NSP_MAX_WINDOW; 1458 u.win = NSP_MAX_WINDOW;
1459 if (u.win == 0) 1459 if (u.win == 0)
1460 return -EINVAL; 1460 return -EINVAL;
1461 scp->max_window = u.win; 1461 scp->max_window = u.win;
1462 if (scp->snd_window > u.win) 1462 if (scp->snd_window > u.win)
1463 scp->snd_window = u.win; 1463 scp->snd_window = u.win;
1464 break; 1464 break;
1465 1465
1466 case DSO_NODELAY: 1466 case DSO_NODELAY:
1467 if (optlen != sizeof(int)) 1467 if (optlen != sizeof(int))
1468 return -EINVAL; 1468 return -EINVAL;
1469 if (scp->nonagle == 2) 1469 if (scp->nonagle == 2)
1470 return -EINVAL; 1470 return -EINVAL;
1471 scp->nonagle = (u.val == 0) ? 0 : 1; 1471 scp->nonagle = (u.val == 0) ? 0 : 1;
1472 /* if (scp->nonagle == 1) { Push pending frames } */ 1472 /* if (scp->nonagle == 1) { Push pending frames } */
1473 break; 1473 break;
1474 1474
1475 case DSO_CORK: 1475 case DSO_CORK:
1476 if (optlen != sizeof(int)) 1476 if (optlen != sizeof(int))
1477 return -EINVAL; 1477 return -EINVAL;
1478 if (scp->nonagle == 1) 1478 if (scp->nonagle == 1)
1479 return -EINVAL; 1479 return -EINVAL;
1480 scp->nonagle = (u.val == 0) ? 0 : 2; 1480 scp->nonagle = (u.val == 0) ? 0 : 2;
1481 /* if (scp->nonagle == 0) { Push pending frames } */ 1481 /* if (scp->nonagle == 0) { Push pending frames } */
1482 break; 1482 break;
1483 1483
1484 case DSO_SERVICES: 1484 case DSO_SERVICES:
1485 if (optlen != sizeof(unsigned char)) 1485 if (optlen != sizeof(unsigned char))
1486 return -EINVAL; 1486 return -EINVAL;
1487 if ((u.services & ~NSP_FC_MASK) != 0x01) 1487 if ((u.services & ~NSP_FC_MASK) != 0x01)
1488 return -EINVAL; 1488 return -EINVAL;
1489 if ((u.services & NSP_FC_MASK) == NSP_FC_MASK) 1489 if ((u.services & NSP_FC_MASK) == NSP_FC_MASK)
1490 return -EINVAL; 1490 return -EINVAL;
1491 scp->services_loc = u.services; 1491 scp->services_loc = u.services;
1492 break; 1492 break;
1493 1493
1494 case DSO_INFO: 1494 case DSO_INFO:
1495 if (optlen != sizeof(unsigned char)) 1495 if (optlen != sizeof(unsigned char))
1496 return -EINVAL; 1496 return -EINVAL;
1497 if (u.info & 0xfc) 1497 if (u.info & 0xfc)
1498 return -EINVAL; 1498 return -EINVAL;
1499 scp->info_loc = u.info; 1499 scp->info_loc = u.info;
1500 break; 1500 break;
1501 } 1501 }
1502 1502
1503 return 0; 1503 return 0;
@@ -1527,107 +1527,106 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us
1527 if(get_user(r_len , optlen)) 1527 if(get_user(r_len , optlen))
1528 return -EFAULT; 1528 return -EFAULT;
1529 1529
1530 switch(optname) { 1530 switch (optname) {
1531 case DSO_CONDATA: 1531 case DSO_CONDATA:
1532 if (r_len > sizeof(struct optdata_dn)) 1532 if (r_len > sizeof(struct optdata_dn))
1533 r_len = sizeof(struct optdata_dn); 1533 r_len = sizeof(struct optdata_dn);
1534 r_data = &scp->conndata_in; 1534 r_data = &scp->conndata_in;
1535 break; 1535 break;
1536
1537 case DSO_DISDATA:
1538 if (r_len > sizeof(struct optdata_dn))
1539 r_len = sizeof(struct optdata_dn);
1540 r_data = &scp->discdata_in;
1541 break;
1542 1536
1543 case DSO_CONACCESS: 1537 case DSO_DISDATA:
1544 if (r_len > sizeof(struct accessdata_dn)) 1538 if (r_len > sizeof(struct optdata_dn))
1545 r_len = sizeof(struct accessdata_dn); 1539 r_len = sizeof(struct optdata_dn);
1546 r_data = &scp->accessdata; 1540 r_data = &scp->discdata_in;
1547 break; 1541 break;
1548 1542
1549 case DSO_ACCEPTMODE: 1543 case DSO_CONACCESS:
1550 if (r_len > sizeof(unsigned char)) 1544 if (r_len > sizeof(struct accessdata_dn))
1551 r_len = sizeof(unsigned char); 1545 r_len = sizeof(struct accessdata_dn);
1552 r_data = &scp->accept_mode; 1546 r_data = &scp->accessdata;
1553 break; 1547 break;
1554 1548
1555 case DSO_LINKINFO: 1549 case DSO_ACCEPTMODE:
1556 if (r_len > sizeof(struct linkinfo_dn)) 1550 if (r_len > sizeof(unsigned char))
1557 r_len = sizeof(struct linkinfo_dn); 1551 r_len = sizeof(unsigned char);
1552 r_data = &scp->accept_mode;
1553 break;
1558 1554
1559 memset(&link, 0, sizeof(link)); 1555 case DSO_LINKINFO:
1556 if (r_len > sizeof(struct linkinfo_dn))
1557 r_len = sizeof(struct linkinfo_dn);
1560 1558
1561 switch(sock->state) { 1559 memset(&link, 0, sizeof(link));
1562 case SS_CONNECTING:
1563 link.idn_linkstate = LL_CONNECTING;
1564 break;
1565 case SS_DISCONNECTING:
1566 link.idn_linkstate = LL_DISCONNECTING;
1567 break;
1568 case SS_CONNECTED:
1569 link.idn_linkstate = LL_RUNNING;
1570 break;
1571 default:
1572 link.idn_linkstate = LL_INACTIVE;
1573 }
1574 1560
1575 link.idn_segsize = scp->segsize_rem; 1561 switch (sock->state) {
1576 r_data = &link; 1562 case SS_CONNECTING:
1563 link.idn_linkstate = LL_CONNECTING;
1564 break;
1565 case SS_DISCONNECTING:
1566 link.idn_linkstate = LL_DISCONNECTING;
1567 break;
1568 case SS_CONNECTED:
1569 link.idn_linkstate = LL_RUNNING;
1577 break; 1570 break;
1578
1579 default: 1571 default:
1572 link.idn_linkstate = LL_INACTIVE;
1573 }
1574
1575 link.idn_segsize = scp->segsize_rem;
1576 r_data = &link;
1577 break;
1578
1579 default:
1580#ifdef CONFIG_NETFILTER 1580#ifdef CONFIG_NETFILTER
1581 { 1581 {
1582 int ret, len; 1582 int ret, len;
1583 1583
1584 if(get_user(len, optlen)) 1584 if (get_user(len, optlen))
1585 return -EFAULT; 1585 return -EFAULT;
1586 1586
1587 ret = nf_getsockopt(sk, PF_DECnet, optname, 1587 ret = nf_getsockopt(sk, PF_DECnet, optname, optval, &len);
1588 optval, &len); 1588 if (ret >= 0)
1589 if (ret >= 0) 1589 ret = put_user(len, optlen);
1590 ret = put_user(len, optlen); 1590 return ret;
1591 return ret; 1591 }
1592 }
1593#endif 1592#endif
1594 case DSO_STREAM: 1593 case DSO_STREAM:
1595 case DSO_SEQPACKET: 1594 case DSO_SEQPACKET:
1596 case DSO_CONACCEPT: 1595 case DSO_CONACCEPT:
1597 case DSO_CONREJECT: 1596 case DSO_CONREJECT:
1598 return -ENOPROTOOPT; 1597 return -ENOPROTOOPT;
1599 1598
1600 case DSO_MAXWINDOW: 1599 case DSO_MAXWINDOW:
1601 if (r_len > sizeof(unsigned long)) 1600 if (r_len > sizeof(unsigned long))
1602 r_len = sizeof(unsigned long); 1601 r_len = sizeof(unsigned long);
1603 r_data = &scp->max_window; 1602 r_data = &scp->max_window;
1604 break; 1603 break;
1605 1604
1606 case DSO_NODELAY: 1605 case DSO_NODELAY:
1607 if (r_len > sizeof(int)) 1606 if (r_len > sizeof(int))
1608 r_len = sizeof(int); 1607 r_len = sizeof(int);
1609 val = (scp->nonagle == 1); 1608 val = (scp->nonagle == 1);
1610 r_data = &val; 1609 r_data = &val;
1611 break; 1610 break;
1612 1611
1613 case DSO_CORK: 1612 case DSO_CORK:
1614 if (r_len > sizeof(int)) 1613 if (r_len > sizeof(int))
1615 r_len = sizeof(int); 1614 r_len = sizeof(int);
1616 val = (scp->nonagle == 2); 1615 val = (scp->nonagle == 2);
1617 r_data = &val; 1616 r_data = &val;
1618 break; 1617 break;
1619 1618
1620 case DSO_SERVICES: 1619 case DSO_SERVICES:
1621 if (r_len > sizeof(unsigned char)) 1620 if (r_len > sizeof(unsigned char))
1622 r_len = sizeof(unsigned char); 1621 r_len = sizeof(unsigned char);
1623 r_data = &scp->services_rem; 1622 r_data = &scp->services_rem;
1624 break; 1623 break;
1625 1624
1626 case DSO_INFO: 1625 case DSO_INFO:
1627 if (r_len > sizeof(unsigned char)) 1626 if (r_len > sizeof(unsigned char))
1628 r_len = sizeof(unsigned char); 1627 r_len = sizeof(unsigned char);
1629 r_data = &scp->info_rem; 1628 r_data = &scp->info_rem;
1630 break; 1629 break;
1631 } 1630 }
1632 1631
1633 if (r_data) { 1632 if (r_data) {
@@ -2088,15 +2087,15 @@ static int dn_device_event(struct notifier_block *this, unsigned long event,
2088 if (!net_eq(dev_net(dev), &init_net)) 2087 if (!net_eq(dev_net(dev), &init_net))
2089 return NOTIFY_DONE; 2088 return NOTIFY_DONE;
2090 2089
2091 switch(event) { 2090 switch (event) {
2092 case NETDEV_UP: 2091 case NETDEV_UP:
2093 dn_dev_up(dev); 2092 dn_dev_up(dev);
2094 break; 2093 break;
2095 case NETDEV_DOWN: 2094 case NETDEV_DOWN:
2096 dn_dev_down(dev); 2095 dn_dev_down(dev);
2097 break; 2096 break;
2098 default: 2097 default:
2099 break; 2098 break;
2100 } 2099 }
2101 2100
2102 return NOTIFY_DONE; 2101 return NOTIFY_DONE;
@@ -2209,54 +2208,54 @@ static void dn_printable_object(struct sockaddr_dn *dn, unsigned char *buf)
2209 int i; 2208 int i;
2210 2209
2211 switch (le16_to_cpu(dn->sdn_objnamel)) { 2210 switch (le16_to_cpu(dn->sdn_objnamel)) {
2212 case 0: 2211 case 0:
2213 sprintf(buf, "%d", dn->sdn_objnum); 2212 sprintf(buf, "%d", dn->sdn_objnum);
2214 break; 2213 break;
2215 default: 2214 default:
2216 for (i = 0; i < le16_to_cpu(dn->sdn_objnamel); i++) { 2215 for (i = 0; i < le16_to_cpu(dn->sdn_objnamel); i++) {
2217 buf[i] = dn->sdn_objname[i]; 2216 buf[i] = dn->sdn_objname[i];
2218 if (IS_NOT_PRINTABLE(buf[i])) 2217 if (IS_NOT_PRINTABLE(buf[i]))
2219 buf[i] = '.'; 2218 buf[i] = '.';
2220 } 2219 }
2221 buf[i] = 0; 2220 buf[i] = 0;
2222 } 2221 }
2223} 2222}
2224 2223
2225static char *dn_state2asc(unsigned char state) 2224static char *dn_state2asc(unsigned char state)
2226{ 2225{
2227 switch(state) { 2226 switch (state) {
2228 case DN_O: 2227 case DN_O:
2229 return "OPEN"; 2228 return "OPEN";
2230 case DN_CR: 2229 case DN_CR:
2231 return " CR"; 2230 return " CR";
2232 case DN_DR: 2231 case DN_DR:
2233 return " DR"; 2232 return " DR";
2234 case DN_DRC: 2233 case DN_DRC:
2235 return " DRC"; 2234 return " DRC";
2236 case DN_CC: 2235 case DN_CC:
2237 return " CC"; 2236 return " CC";
2238 case DN_CI: 2237 case DN_CI:
2239 return " CI"; 2238 return " CI";
2240 case DN_NR: 2239 case DN_NR:
2241 return " NR"; 2240 return " NR";
2242 case DN_NC: 2241 case DN_NC:
2243 return " NC"; 2242 return " NC";
2244 case DN_CD: 2243 case DN_CD:
2245 return " CD"; 2244 return " CD";
2246 case DN_RJ: 2245 case DN_RJ:
2247 return " RJ"; 2246 return " RJ";
2248 case DN_RUN: 2247 case DN_RUN:
2249 return " RUN"; 2248 return " RUN";
2250 case DN_DI: 2249 case DN_DI:
2251 return " DI"; 2250 return " DI";
2252 case DN_DIC: 2251 case DN_DIC:
2253 return " DIC"; 2252 return " DIC";
2254 case DN_DN: 2253 case DN_DN:
2255 return " DN"; 2254 return " DN";
2256 case DN_CL: 2255 case DN_CL:
2257 return " CL"; 2256 return " CL";
2258 case DN_CN: 2257 case DN_CN:
2259 return " CN"; 2258 return " CN";
2260 } 2259 }
2261 2260
2262 return "????"; 2261 return "????";
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index cf26ac74a188..ba4faceec405 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -437,17 +437,17 @@ int dn_dev_ioctl(unsigned int cmd, void __user *arg)
437 437
438 dev_load(&init_net, ifr->ifr_name); 438 dev_load(&init_net, ifr->ifr_name);
439 439
440 switch(cmd) { 440 switch (cmd) {
441 case SIOCGIFADDR: 441 case SIOCGIFADDR:
442 break; 442 break;
443 case SIOCSIFADDR: 443 case SIOCSIFADDR:
444 if (!capable(CAP_NET_ADMIN)) 444 if (!capable(CAP_NET_ADMIN))
445 return -EACCES; 445 return -EACCES;
446 if (sdn->sdn_family != AF_DECnet) 446 if (sdn->sdn_family != AF_DECnet)
447 return -EINVAL;
448 break;
449 default:
450 return -EINVAL; 447 return -EINVAL;
448 break;
449 default:
450 return -EINVAL;
451 } 451 }
452 452
453 rtnl_lock(); 453 rtnl_lock();
@@ -470,27 +470,27 @@ int dn_dev_ioctl(unsigned int cmd, void __user *arg)
470 goto done; 470 goto done;
471 } 471 }
472 472
473 switch(cmd) { 473 switch (cmd) {
474 case SIOCGIFADDR: 474 case SIOCGIFADDR:
475 *((__le16 *)sdn->sdn_nodeaddr) = ifa->ifa_local; 475 *((__le16 *)sdn->sdn_nodeaddr) = ifa->ifa_local;
476 goto rarok; 476 goto rarok;
477 477
478 case SIOCSIFADDR: 478 case SIOCSIFADDR:
479 if (!ifa) { 479 if (!ifa) {
480 if ((ifa = dn_dev_alloc_ifa()) == NULL) { 480 if ((ifa = dn_dev_alloc_ifa()) == NULL) {
481 ret = -ENOBUFS; 481 ret = -ENOBUFS;
482 break; 482 break;
483 }
484 memcpy(ifa->ifa_label, dev->name, IFNAMSIZ);
485 } else {
486 if (ifa->ifa_local == dn_saddr2dn(sdn))
487 break;
488 dn_dev_del_ifa(dn_db, ifap, 0);
489 } 483 }
484 memcpy(ifa->ifa_label, dev->name, IFNAMSIZ);
485 } else {
486 if (ifa->ifa_local == dn_saddr2dn(sdn))
487 break;
488 dn_dev_del_ifa(dn_db, ifap, 0);
489 }
490 490
491 ifa->ifa_local = ifa->ifa_address = dn_saddr2dn(sdn); 491 ifa->ifa_local = ifa->ifa_address = dn_saddr2dn(sdn);
492 492
493 ret = dn_dev_set_ifa(dev, ifa); 493 ret = dn_dev_set_ifa(dev, ifa);
494 } 494 }
495done: 495done:
496 rtnl_unlock(); 496 rtnl_unlock();
@@ -1313,7 +1313,7 @@ static void *dn_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1313 1313
1314 ++*pos; 1314 ++*pos;
1315 1315
1316 dev = (struct net_device *)v; 1316 dev = v;
1317 if (v == SEQ_START_TOKEN) 1317 if (v == SEQ_START_TOKEN)
1318 dev = net_device_entry(&init_net.dev_base_head); 1318 dev = net_device_entry(&init_net.dev_base_head);
1319 1319
@@ -1335,13 +1335,13 @@ static void dn_dev_seq_stop(struct seq_file *seq, void *v)
1335 1335
1336static char *dn_type2asc(char type) 1336static char *dn_type2asc(char type)
1337{ 1337{
1338 switch(type) { 1338 switch (type) {
1339 case DN_DEV_BCAST: 1339 case DN_DEV_BCAST:
1340 return "B"; 1340 return "B";
1341 case DN_DEV_UCAST: 1341 case DN_DEV_UCAST:
1342 return "U"; 1342 return "U";
1343 case DN_DEV_MPOINT: 1343 case DN_DEV_MPOINT:
1344 return "M"; 1344 return "M";
1345 } 1345 }
1346 1346
1347 return "?"; 1347 return "?";
@@ -1414,9 +1414,9 @@ void __init dn_dev_init(void)
1414 1414
1415 dn_dev_devices_on(); 1415 dn_dev_devices_on();
1416 1416
1417 rtnl_register(PF_DECnet, RTM_NEWADDR, dn_nl_newaddr, NULL); 1417 rtnl_register(PF_DECnet, RTM_NEWADDR, dn_nl_newaddr, NULL, NULL);
1418 rtnl_register(PF_DECnet, RTM_DELADDR, dn_nl_deladdr, NULL); 1418 rtnl_register(PF_DECnet, RTM_DELADDR, dn_nl_deladdr, NULL, NULL);
1419 rtnl_register(PF_DECnet, RTM_GETADDR, NULL, dn_nl_dump_ifaddr); 1419 rtnl_register(PF_DECnet, RTM_GETADDR, NULL, dn_nl_dump_ifaddr, NULL);
1420 1420
1421 proc_net_fops_create(&init_net, "decnet_dev", S_IRUGO, &dn_dev_seq_fops); 1421 proc_net_fops_create(&init_net, "decnet_dev", S_IRUGO, &dn_dev_seq_fops);
1422 1422
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c
index 1c74ed36ce8f..2bd8e53d7774 100644
--- a/net/decnet/dn_fib.c
+++ b/net/decnet/dn_fib.c
@@ -414,33 +414,34 @@ int dn_fib_semantic_match(int type, struct dn_fib_info *fi, const struct flowidn
414 414
415 res->fi = fi; 415 res->fi = fi;
416 416
417 switch(type) { 417 switch (type) {
418 case RTN_NAT: 418 case RTN_NAT:
419 DN_FIB_RES_RESET(*res); 419 DN_FIB_RES_RESET(*res);
420 atomic_inc(&fi->fib_clntref);
421 return 0;
422 case RTN_UNICAST:
423 case RTN_LOCAL:
424 for_nexthops(fi) {
425 if (nh->nh_flags & RTNH_F_DEAD)
426 continue;
427 if (!fld->flowidn_oif ||
428 fld->flowidn_oif == nh->nh_oif)
429 break;
430 }
431 if (nhsel < fi->fib_nhs) {
432 res->nh_sel = nhsel;
420 atomic_inc(&fi->fib_clntref); 433 atomic_inc(&fi->fib_clntref);
421 return 0; 434 return 0;
422 case RTN_UNICAST: 435 }
423 case RTN_LOCAL: 436 endfor_nexthops(fi);
424 for_nexthops(fi) { 437 res->fi = NULL;
425 if (nh->nh_flags & RTNH_F_DEAD) 438 return 1;
426 continue; 439 default:
427 if (!fld->flowidn_oif || 440 if (net_ratelimit())
428 fld->flowidn_oif == nh->nh_oif) 441 printk("DECnet: impossible routing event : dn_fib_semantic_match type=%d\n",
429 break; 442 type);
430 } 443 res->fi = NULL;
431 if (nhsel < fi->fib_nhs) { 444 return -EINVAL;
432 res->nh_sel = nhsel;
433 atomic_inc(&fi->fib_clntref);
434 return 0;
435 }
436 endfor_nexthops(fi);
437 res->fi = NULL;
438 return 1;
439 default:
440 if (net_ratelimit())
441 printk("DECnet: impossible routing event : dn_fib_semantic_match type=%d\n", type);
442 res->fi = NULL;
443 return -EINVAL;
444 } 445 }
445 } 446 }
446 return err; 447 return err;
@@ -647,20 +648,20 @@ static int dn_fib_dnaddr_event(struct notifier_block *this, unsigned long event,
647{ 648{
648 struct dn_ifaddr *ifa = (struct dn_ifaddr *)ptr; 649 struct dn_ifaddr *ifa = (struct dn_ifaddr *)ptr;
649 650
650 switch(event) { 651 switch (event) {
651 case NETDEV_UP: 652 case NETDEV_UP:
652 dn_fib_add_ifaddr(ifa); 653 dn_fib_add_ifaddr(ifa);
653 dn_fib_sync_up(ifa->ifa_dev->dev); 654 dn_fib_sync_up(ifa->ifa_dev->dev);
655 dn_rt_cache_flush(-1);
656 break;
657 case NETDEV_DOWN:
658 dn_fib_del_ifaddr(ifa);
659 if (ifa->ifa_dev && ifa->ifa_dev->ifa_list == NULL) {
660 dn_fib_disable_addr(ifa->ifa_dev->dev, 1);
661 } else {
654 dn_rt_cache_flush(-1); 662 dn_rt_cache_flush(-1);
655 break; 663 }
656 case NETDEV_DOWN: 664 break;
657 dn_fib_del_ifaddr(ifa);
658 if (ifa->ifa_dev && ifa->ifa_dev->ifa_list == NULL) {
659 dn_fib_disable_addr(ifa->ifa_dev->dev, 1);
660 } else {
661 dn_rt_cache_flush(-1);
662 }
663 break;
664 } 665 }
665 return NOTIFY_DONE; 666 return NOTIFY_DONE;
666} 667}
@@ -763,8 +764,8 @@ void __init dn_fib_init(void)
763 764
764 register_dnaddr_notifier(&dn_fib_dnaddr_notifier); 765 register_dnaddr_notifier(&dn_fib_dnaddr_notifier);
765 766
766 rtnl_register(PF_DECnet, RTM_NEWROUTE, dn_fib_rtm_newroute, NULL); 767 rtnl_register(PF_DECnet, RTM_NEWROUTE, dn_fib_rtm_newroute, NULL, NULL);
767 rtnl_register(PF_DECnet, RTM_DELROUTE, dn_fib_rtm_delroute, NULL); 768 rtnl_register(PF_DECnet, RTM_DELROUTE, dn_fib_rtm_delroute, NULL, NULL);
768} 769}
769 770
770 771
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
index 602dade7e9a3..0dc3fe61085b 100644
--- a/net/decnet/dn_neigh.c
+++ b/net/decnet/dn_neigh.c
@@ -51,9 +51,9 @@
51static int dn_neigh_construct(struct neighbour *); 51static int dn_neigh_construct(struct neighbour *);
52static void dn_long_error_report(struct neighbour *, struct sk_buff *); 52static void dn_long_error_report(struct neighbour *, struct sk_buff *);
53static void dn_short_error_report(struct neighbour *, struct sk_buff *); 53static void dn_short_error_report(struct neighbour *, struct sk_buff *);
54static int dn_long_output(struct sk_buff *); 54static int dn_long_output(struct neighbour *, struct sk_buff *);
55static int dn_short_output(struct sk_buff *); 55static int dn_short_output(struct neighbour *, struct sk_buff *);
56static int dn_phase3_output(struct sk_buff *); 56static int dn_phase3_output(struct neighbour *, struct sk_buff *);
57 57
58 58
59/* 59/*
@@ -64,8 +64,6 @@ static const struct neigh_ops dn_long_ops = {
64 .error_report = dn_long_error_report, 64 .error_report = dn_long_error_report,
65 .output = dn_long_output, 65 .output = dn_long_output,
66 .connected_output = dn_long_output, 66 .connected_output = dn_long_output,
67 .hh_output = dev_queue_xmit,
68 .queue_xmit = dev_queue_xmit,
69}; 67};
70 68
71/* 69/*
@@ -76,8 +74,6 @@ static const struct neigh_ops dn_short_ops = {
76 .error_report = dn_short_error_report, 74 .error_report = dn_short_error_report,
77 .output = dn_short_output, 75 .output = dn_short_output,
78 .connected_output = dn_short_output, 76 .connected_output = dn_short_output,
79 .hh_output = dev_queue_xmit,
80 .queue_xmit = dev_queue_xmit,
81}; 77};
82 78
83/* 79/*
@@ -88,8 +84,6 @@ static const struct neigh_ops dn_phase3_ops = {
88 .error_report = dn_short_error_report, /* Can use short version here */ 84 .error_report = dn_short_error_report, /* Can use short version here */
89 .output = dn_phase3_output, 85 .output = dn_phase3_output,
90 .connected_output = dn_phase3_output, 86 .connected_output = dn_phase3_output,
91 .hh_output = dev_queue_xmit,
92 .queue_xmit = dev_queue_xmit
93}; 87};
94 88
95static u32 dn_neigh_hash(const void *pkey, 89static u32 dn_neigh_hash(const void *pkey,
@@ -208,14 +202,14 @@ static int dn_neigh_output_packet(struct sk_buff *skb)
208{ 202{
209 struct dst_entry *dst = skb_dst(skb); 203 struct dst_entry *dst = skb_dst(skb);
210 struct dn_route *rt = (struct dn_route *)dst; 204 struct dn_route *rt = (struct dn_route *)dst;
211 struct neighbour *neigh = dst->neighbour; 205 struct neighbour *neigh = dst_get_neighbour(dst);
212 struct net_device *dev = neigh->dev; 206 struct net_device *dev = neigh->dev;
213 char mac_addr[ETH_ALEN]; 207 char mac_addr[ETH_ALEN];
214 208
215 dn_dn2eth(mac_addr, rt->rt_local_src); 209 dn_dn2eth(mac_addr, rt->rt_local_src);
216 if (dev_hard_header(skb, dev, ntohs(skb->protocol), neigh->ha, 210 if (dev_hard_header(skb, dev, ntohs(skb->protocol), neigh->ha,
217 mac_addr, skb->len) >= 0) 211 mac_addr, skb->len) >= 0)
218 return neigh->ops->queue_xmit(skb); 212 return dev_queue_xmit(skb);
219 213
220 if (net_ratelimit()) 214 if (net_ratelimit())
221 printk(KERN_DEBUG "dn_neigh_output_packet: oops, can't send packet\n"); 215 printk(KERN_DEBUG "dn_neigh_output_packet: oops, can't send packet\n");
@@ -224,10 +218,8 @@ static int dn_neigh_output_packet(struct sk_buff *skb)
224 return -EINVAL; 218 return -EINVAL;
225} 219}
226 220
227static int dn_long_output(struct sk_buff *skb) 221static int dn_long_output(struct neighbour *neigh, struct sk_buff *skb)
228{ 222{
229 struct dst_entry *dst = skb_dst(skb);
230 struct neighbour *neigh = dst->neighbour;
231 struct net_device *dev = neigh->dev; 223 struct net_device *dev = neigh->dev;
232 int headroom = dev->hard_header_len + sizeof(struct dn_long_packet) + 3; 224 int headroom = dev->hard_header_len + sizeof(struct dn_long_packet) + 3;
233 unsigned char *data; 225 unsigned char *data;
@@ -271,10 +263,8 @@ static int dn_long_output(struct sk_buff *skb)
271 neigh->dev, dn_neigh_output_packet); 263 neigh->dev, dn_neigh_output_packet);
272} 264}
273 265
274static int dn_short_output(struct sk_buff *skb) 266static int dn_short_output(struct neighbour *neigh, struct sk_buff *skb)
275{ 267{
276 struct dst_entry *dst = skb_dst(skb);
277 struct neighbour *neigh = dst->neighbour;
278 struct net_device *dev = neigh->dev; 268 struct net_device *dev = neigh->dev;
279 int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2; 269 int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2;
280 struct dn_short_packet *sp; 270 struct dn_short_packet *sp;
@@ -315,10 +305,8 @@ static int dn_short_output(struct sk_buff *skb)
315 * Phase 3 output is the same is short output, execpt that 305 * Phase 3 output is the same is short output, execpt that
316 * it clears the area bits before transmission. 306 * it clears the area bits before transmission.
317 */ 307 */
318static int dn_phase3_output(struct sk_buff *skb) 308static int dn_phase3_output(struct neighbour *neigh, struct sk_buff *skb)
319{ 309{
320 struct dst_entry *dst = skb_dst(skb);
321 struct neighbour *neigh = dst->neighbour;
322 struct net_device *dev = neigh->dev; 310 struct net_device *dev = neigh->dev;
323 int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2; 311 int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2;
324 struct dn_short_packet *sp; 312 struct dn_short_packet *sp;
@@ -404,13 +392,13 @@ int dn_neigh_router_hello(struct sk_buff *skb)
404 392
405 dn->flags &= ~DN_NDFLAG_P3; 393 dn->flags &= ~DN_NDFLAG_P3;
406 394
407 switch(msg->iinfo & DN_RT_INFO_TYPE) { 395 switch (msg->iinfo & DN_RT_INFO_TYPE) {
408 case DN_RT_INFO_L1RT: 396 case DN_RT_INFO_L1RT:
409 dn->flags &=~DN_NDFLAG_R2; 397 dn->flags &=~DN_NDFLAG_R2;
410 dn->flags |= DN_NDFLAG_R1; 398 dn->flags |= DN_NDFLAG_R1;
411 break; 399 break;
412 case DN_RT_INFO_L2RT: 400 case DN_RT_INFO_L2RT:
413 dn->flags |= DN_NDFLAG_R2; 401 dn->flags |= DN_NDFLAG_R2;
414 } 402 }
415 } 403 }
416 404
diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c
index b430549e2b91..73fa268fe2e8 100644
--- a/net/decnet/dn_nsp_in.c
+++ b/net/decnet/dn_nsp_in.c
@@ -101,23 +101,27 @@ static void dn_ack(struct sock *sk, struct sk_buff *skb, unsigned short ack)
101 unsigned short type = ((ack >> 12) & 0x0003); 101 unsigned short type = ((ack >> 12) & 0x0003);
102 int wakeup = 0; 102 int wakeup = 0;
103 103
104 switch(type) { 104 switch (type) {
105 case 0: /* ACK - Data */ 105 case 0: /* ACK - Data */
106 if (dn_after(ack, scp->ackrcv_dat)) { 106 if (dn_after(ack, scp->ackrcv_dat)) {
107 scp->ackrcv_dat = ack & 0x0fff; 107 scp->ackrcv_dat = ack & 0x0fff;
108 wakeup |= dn_nsp_check_xmit_queue(sk, skb, &scp->data_xmit_queue, ack); 108 wakeup |= dn_nsp_check_xmit_queue(sk, skb,
109 } 109 &scp->data_xmit_queue,
110 break; 110 ack);
111 case 1: /* NAK - Data */ 111 }
112 break; 112 break;
113 case 2: /* ACK - OtherData */ 113 case 1: /* NAK - Data */
114 if (dn_after(ack, scp->ackrcv_oth)) { 114 break;
115 scp->ackrcv_oth = ack & 0x0fff; 115 case 2: /* ACK - OtherData */
116 wakeup |= dn_nsp_check_xmit_queue(sk, skb, &scp->other_xmit_queue, ack); 116 if (dn_after(ack, scp->ackrcv_oth)) {
117 } 117 scp->ackrcv_oth = ack & 0x0fff;
118 break; 118 wakeup |= dn_nsp_check_xmit_queue(sk, skb,
119 case 3: /* NAK - OtherData */ 119 &scp->other_xmit_queue,
120 break; 120 ack);
121 }
122 break;
123 case 3: /* NAK - OtherData */
124 break;
121 } 125 }
122 126
123 if (wakeup && !sock_flag(sk, SOCK_DEAD)) 127 if (wakeup && !sock_flag(sk, SOCK_DEAD))
@@ -417,19 +421,19 @@ static void dn_nsp_disc_init(struct sock *sk, struct sk_buff *skb)
417 scp->addrrem = cb->src_port; 421 scp->addrrem = cb->src_port;
418 sk->sk_state = TCP_CLOSE; 422 sk->sk_state = TCP_CLOSE;
419 423
420 switch(scp->state) { 424 switch (scp->state) {
421 case DN_CI: 425 case DN_CI:
422 case DN_CD: 426 case DN_CD:
423 scp->state = DN_RJ; 427 scp->state = DN_RJ;
424 sk->sk_err = ECONNREFUSED; 428 sk->sk_err = ECONNREFUSED;
425 break; 429 break;
426 case DN_RUN: 430 case DN_RUN:
427 sk->sk_shutdown |= SHUTDOWN_MASK; 431 sk->sk_shutdown |= SHUTDOWN_MASK;
428 scp->state = DN_DN; 432 scp->state = DN_DN;
429 break; 433 break;
430 case DN_DI: 434 case DN_DI:
431 scp->state = DN_DIC; 435 scp->state = DN_DIC;
432 break; 436 break;
433 } 437 }
434 438
435 if (!sock_flag(sk, SOCK_DEAD)) { 439 if (!sock_flag(sk, SOCK_DEAD)) {
@@ -470,23 +474,23 @@ static void dn_nsp_disc_conf(struct sock *sk, struct sk_buff *skb)
470 474
471 sk->sk_state = TCP_CLOSE; 475 sk->sk_state = TCP_CLOSE;
472 476
473 switch(scp->state) { 477 switch (scp->state) {
474 case DN_CI: 478 case DN_CI:
475 scp->state = DN_NR; 479 scp->state = DN_NR;
476 break; 480 break;
477 case DN_DR: 481 case DN_DR:
478 if (reason == NSP_REASON_DC) 482 if (reason == NSP_REASON_DC)
479 scp->state = DN_DRC; 483 scp->state = DN_DRC;
480 if (reason == NSP_REASON_NL) 484 if (reason == NSP_REASON_NL)
481 scp->state = DN_CN;
482 break;
483 case DN_DI:
484 scp->state = DN_DIC;
485 break;
486 case DN_RUN:
487 sk->sk_shutdown |= SHUTDOWN_MASK;
488 case DN_CC:
489 scp->state = DN_CN; 485 scp->state = DN_CN;
486 break;
487 case DN_DI:
488 scp->state = DN_DIC;
489 break;
490 case DN_RUN:
491 sk->sk_shutdown |= SHUTDOWN_MASK;
492 case DN_CC:
493 scp->state = DN_CN;
490 } 494 }
491 495
492 if (!sock_flag(sk, SOCK_DEAD)) { 496 if (!sock_flag(sk, SOCK_DEAD)) {
@@ -692,16 +696,16 @@ static int dn_nsp_no_socket(struct sk_buff *skb, unsigned short reason)
692 goto out; 696 goto out;
693 697
694 if ((reason != NSP_REASON_OK) && ((cb->nsp_flags & 0x0c) == 0x08)) { 698 if ((reason != NSP_REASON_OK) && ((cb->nsp_flags & 0x0c) == 0x08)) {
695 switch(cb->nsp_flags & 0x70) { 699 switch (cb->nsp_flags & 0x70) {
696 case 0x10: 700 case 0x10:
697 case 0x60: /* (Retransmitted) Connect Init */ 701 case 0x60: /* (Retransmitted) Connect Init */
698 dn_nsp_return_disc(skb, NSP_DISCINIT, reason); 702 dn_nsp_return_disc(skb, NSP_DISCINIT, reason);
699 ret = NET_RX_SUCCESS; 703 ret = NET_RX_SUCCESS;
700 break; 704 break;
701 case 0x20: /* Connect Confirm */ 705 case 0x20: /* Connect Confirm */
702 dn_nsp_return_disc(skb, NSP_DISCCONF, reason); 706 dn_nsp_return_disc(skb, NSP_DISCCONF, reason);
703 ret = NET_RX_SUCCESS; 707 ret = NET_RX_SUCCESS;
704 break; 708 break;
705 } 709 }
706 } 710 }
707 711
@@ -733,17 +737,17 @@ static int dn_nsp_rx_packet(struct sk_buff *skb)
733 * Filter out conninits and useless packet types 737 * Filter out conninits and useless packet types
734 */ 738 */
735 if ((cb->nsp_flags & 0x0c) == 0x08) { 739 if ((cb->nsp_flags & 0x0c) == 0x08) {
736 switch(cb->nsp_flags & 0x70) { 740 switch (cb->nsp_flags & 0x70) {
737 case 0x00: /* NOP */ 741 case 0x00: /* NOP */
738 case 0x70: /* Reserved */ 742 case 0x70: /* Reserved */
739 case 0x50: /* Reserved, Phase II node init */ 743 case 0x50: /* Reserved, Phase II node init */
744 goto free_out;
745 case 0x10:
746 case 0x60:
747 if (unlikely(cb->rt_flags & DN_RT_F_RTS))
740 goto free_out; 748 goto free_out;
741 case 0x10: 749 sk = dn_find_listener(skb, &reason);
742 case 0x60: 750 goto got_it;
743 if (unlikely(cb->rt_flags & DN_RT_F_RTS))
744 goto free_out;
745 sk = dn_find_listener(skb, &reason);
746 goto got_it;
747 } 751 }
748 } 752 }
749 753
@@ -836,20 +840,20 @@ int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb)
836 * Control packet. 840 * Control packet.
837 */ 841 */
838 if ((cb->nsp_flags & 0x0c) == 0x08) { 842 if ((cb->nsp_flags & 0x0c) == 0x08) {
839 switch(cb->nsp_flags & 0x70) { 843 switch (cb->nsp_flags & 0x70) {
840 case 0x10: 844 case 0x10:
841 case 0x60: 845 case 0x60:
842 dn_nsp_conn_init(sk, skb); 846 dn_nsp_conn_init(sk, skb);
843 break; 847 break;
844 case 0x20: 848 case 0x20:
845 dn_nsp_conn_conf(sk, skb); 849 dn_nsp_conn_conf(sk, skb);
846 break; 850 break;
847 case 0x30: 851 case 0x30:
848 dn_nsp_disc_init(sk, skb); 852 dn_nsp_disc_init(sk, skb);
849 break; 853 break;
850 case 0x40: 854 case 0x40:
851 dn_nsp_disc_conf(sk, skb); 855 dn_nsp_disc_conf(sk, skb);
852 break; 856 break;
853 } 857 }
854 858
855 } else if (cb->nsp_flags == 0x24) { 859 } else if (cb->nsp_flags == 0x24) {
@@ -890,15 +894,15 @@ int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb)
890 if (scp->state != DN_RUN) 894 if (scp->state != DN_RUN)
891 goto free_out; 895 goto free_out;
892 896
893 switch(cb->nsp_flags) { 897 switch (cb->nsp_flags) {
894 case 0x10: /* LS */ 898 case 0x10: /* LS */
895 dn_nsp_linkservice(sk, skb); 899 dn_nsp_linkservice(sk, skb);
896 break; 900 break;
897 case 0x30: /* OD */ 901 case 0x30: /* OD */
898 dn_nsp_otherdata(sk, skb); 902 dn_nsp_otherdata(sk, skb);
899 break; 903 break;
900 default: 904 default:
901 dn_nsp_data(sk, skb); 905 dn_nsp_data(sk, skb);
902 } 906 }
903 907
904 } else { /* Ack, chuck it out here */ 908 } else { /* Ack, chuck it out here */
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 74544bc6fdec..43450c100226 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -116,6 +116,7 @@ static void dn_dst_destroy(struct dst_entry *);
116static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); 116static struct dst_entry *dn_dst_negative_advice(struct dst_entry *);
117static void dn_dst_link_failure(struct sk_buff *); 117static void dn_dst_link_failure(struct sk_buff *);
118static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu); 118static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu);
119static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr);
119static int dn_route_input(struct sk_buff *); 120static int dn_route_input(struct sk_buff *);
120static void dn_run_flush(unsigned long dummy); 121static void dn_run_flush(unsigned long dummy);
121 122
@@ -139,6 +140,7 @@ static struct dst_ops dn_dst_ops = {
139 .negative_advice = dn_dst_negative_advice, 140 .negative_advice = dn_dst_negative_advice,
140 .link_failure = dn_dst_link_failure, 141 .link_failure = dn_dst_link_failure,
141 .update_pmtu = dn_dst_update_pmtu, 142 .update_pmtu = dn_dst_update_pmtu,
143 .neigh_lookup = dn_dst_neigh_lookup,
142}; 144};
143 145
144static void dn_dst_destroy(struct dst_entry *dst) 146static void dn_dst_destroy(struct dst_entry *dst)
@@ -241,9 +243,11 @@ static int dn_dst_gc(struct dst_ops *ops)
241 */ 243 */
242static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu) 244static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu)
243{ 245{
246 struct neighbour *n = dst_get_neighbour(dst);
244 u32 min_mtu = 230; 247 u32 min_mtu = 230;
245 struct dn_dev *dn = dst->neighbour ? 248 struct dn_dev *dn;
246 rcu_dereference_raw(dst->neighbour->dev->dn_ptr) : NULL; 249
250 dn = n ? rcu_dereference_raw(n->dev->dn_ptr) : NULL;
247 251
248 if (dn && dn->use_long == 0) 252 if (dn && dn->use_long == 0)
249 min_mtu -= 6; 253 min_mtu -= 6;
@@ -495,11 +499,11 @@ static int dn_route_rx_packet(struct sk_buff *skb)
495 } 499 }
496 500
497 if ((skb->pkt_type == PACKET_HOST) && (cb->rt_flags & DN_RT_F_RQR)) { 501 if ((skb->pkt_type == PACKET_HOST) && (cb->rt_flags & DN_RT_F_RQR)) {
498 switch(cb->rt_flags & DN_RT_PKT_MSK) { 502 switch (cb->rt_flags & DN_RT_PKT_MSK) {
499 case DN_RT_PKT_SHORT: 503 case DN_RT_PKT_SHORT:
500 return dn_return_short(skb); 504 return dn_return_short(skb);
501 case DN_RT_PKT_LONG: 505 case DN_RT_PKT_LONG:
502 return dn_return_long(skb); 506 return dn_return_long(skb);
503 } 507 }
504 } 508 }
505 509
@@ -652,38 +656,38 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
652 if (unlikely(skb_linearize(skb))) 656 if (unlikely(skb_linearize(skb)))
653 goto dump_it; 657 goto dump_it;
654 658
655 switch(flags & DN_RT_CNTL_MSK) { 659 switch (flags & DN_RT_CNTL_MSK) {
656 case DN_RT_PKT_INIT: 660 case DN_RT_PKT_INIT:
657 dn_dev_init_pkt(skb); 661 dn_dev_init_pkt(skb);
658 break; 662 break;
659 case DN_RT_PKT_VERI: 663 case DN_RT_PKT_VERI:
660 dn_dev_veri_pkt(skb); 664 dn_dev_veri_pkt(skb);
661 break; 665 break;
662 } 666 }
663 667
664 if (dn->parms.state != DN_DEV_S_RU) 668 if (dn->parms.state != DN_DEV_S_RU)
665 goto dump_it; 669 goto dump_it;
666 670
667 switch(flags & DN_RT_CNTL_MSK) { 671 switch (flags & DN_RT_CNTL_MSK) {
668 case DN_RT_PKT_HELO: 672 case DN_RT_PKT_HELO:
669 return NF_HOOK(NFPROTO_DECNET, NF_DN_HELLO, 673 return NF_HOOK(NFPROTO_DECNET, NF_DN_HELLO,
670 skb, skb->dev, NULL, 674 skb, skb->dev, NULL,
671 dn_route_ptp_hello); 675 dn_route_ptp_hello);
672 676
673 case DN_RT_PKT_L1RT: 677 case DN_RT_PKT_L1RT:
674 case DN_RT_PKT_L2RT: 678 case DN_RT_PKT_L2RT:
675 return NF_HOOK(NFPROTO_DECNET, NF_DN_ROUTE, 679 return NF_HOOK(NFPROTO_DECNET, NF_DN_ROUTE,
676 skb, skb->dev, NULL, 680 skb, skb->dev, NULL,
677 dn_route_discard); 681 dn_route_discard);
678 case DN_RT_PKT_ERTH: 682 case DN_RT_PKT_ERTH:
679 return NF_HOOK(NFPROTO_DECNET, NF_DN_HELLO, 683 return NF_HOOK(NFPROTO_DECNET, NF_DN_HELLO,
680 skb, skb->dev, NULL, 684 skb, skb->dev, NULL,
681 dn_neigh_router_hello); 685 dn_neigh_router_hello);
682 686
683 case DN_RT_PKT_EEDH: 687 case DN_RT_PKT_EEDH:
684 return NF_HOOK(NFPROTO_DECNET, NF_DN_HELLO, 688 return NF_HOOK(NFPROTO_DECNET, NF_DN_HELLO,
685 skb, skb->dev, NULL, 689 skb, skb->dev, NULL,
686 dn_neigh_endnode_hello); 690 dn_neigh_endnode_hello);
687 } 691 }
688 } else { 692 } else {
689 if (dn->parms.state != DN_DEV_S_RU) 693 if (dn->parms.state != DN_DEV_S_RU)
@@ -691,11 +695,11 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
691 695
692 skb_pull(skb, 1); /* Pull flags */ 696 skb_pull(skb, 1); /* Pull flags */
693 697
694 switch(flags & DN_RT_PKT_MSK) { 698 switch (flags & DN_RT_PKT_MSK) {
695 case DN_RT_PKT_LONG: 699 case DN_RT_PKT_LONG:
696 return dn_route_rx_long(skb); 700 return dn_route_rx_long(skb);
697 case DN_RT_PKT_SHORT: 701 case DN_RT_PKT_SHORT:
698 return dn_route_rx_short(skb); 702 return dn_route_rx_short(skb);
699 } 703 }
700 } 704 }
701 705
@@ -705,6 +709,14 @@ out:
705 return NET_RX_DROP; 709 return NET_RX_DROP;
706} 710}
707 711
712static int dn_to_neigh_output(struct sk_buff *skb)
713{
714 struct dst_entry *dst = skb_dst(skb);
715 struct neighbour *n = dst_get_neighbour(dst);
716
717 return n->output(n, skb);
718}
719
708static int dn_output(struct sk_buff *skb) 720static int dn_output(struct sk_buff *skb)
709{ 721{
710 struct dst_entry *dst = skb_dst(skb); 722 struct dst_entry *dst = skb_dst(skb);
@@ -715,7 +727,7 @@ static int dn_output(struct sk_buff *skb)
715 727
716 int err = -EINVAL; 728 int err = -EINVAL;
717 729
718 if ((neigh = dst->neighbour) == NULL) 730 if ((neigh = dst_get_neighbour(dst)) == NULL)
719 goto error; 731 goto error;
720 732
721 skb->dev = dev; 733 skb->dev = dev;
@@ -733,7 +745,7 @@ static int dn_output(struct sk_buff *skb)
733 cb->hops = 0; 745 cb->hops = 0;
734 746
735 return NF_HOOK(NFPROTO_DECNET, NF_DN_LOCAL_OUT, skb, NULL, dev, 747 return NF_HOOK(NFPROTO_DECNET, NF_DN_LOCAL_OUT, skb, NULL, dev,
736 neigh->output); 748 dn_to_neigh_output);
737 749
738error: 750error:
739 if (net_ratelimit()) 751 if (net_ratelimit())
@@ -750,7 +762,6 @@ static int dn_forward(struct sk_buff *skb)
750 struct dst_entry *dst = skb_dst(skb); 762 struct dst_entry *dst = skb_dst(skb);
751 struct dn_dev *dn_db = rcu_dereference(dst->dev->dn_ptr); 763 struct dn_dev *dn_db = rcu_dereference(dst->dev->dn_ptr);
752 struct dn_route *rt; 764 struct dn_route *rt;
753 struct neighbour *neigh = dst->neighbour;
754 int header_len; 765 int header_len;
755#ifdef CONFIG_NETFILTER 766#ifdef CONFIG_NETFILTER
756 struct net_device *dev = skb->dev; 767 struct net_device *dev = skb->dev;
@@ -783,7 +794,7 @@ static int dn_forward(struct sk_buff *skb)
783 cb->rt_flags |= DN_RT_F_IE; 794 cb->rt_flags |= DN_RT_F_IE;
784 795
785 return NF_HOOK(NFPROTO_DECNET, NF_DN_FORWARD, skb, dev, skb->dev, 796 return NF_HOOK(NFPROTO_DECNET, NF_DN_FORWARD, skb, dev, skb->dev,
786 neigh->output); 797 dn_to_neigh_output);
787 798
788drop: 799drop:
789 kfree_skb(skb); 800 kfree_skb(skb);
@@ -818,6 +829,11 @@ static unsigned int dn_dst_default_mtu(const struct dst_entry *dst)
818 return dst->dev->mtu; 829 return dst->dev->mtu;
819} 830}
820 831
832static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
833{
834 return __neigh_lookup_errno(&dn_neigh_table, daddr, dst->dev);
835}
836
821static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) 837static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res)
822{ 838{
823 struct dn_fib_info *fi = res->fi; 839 struct dn_fib_info *fi = res->fi;
@@ -833,11 +849,11 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res)
833 } 849 }
834 rt->rt_type = res->type; 850 rt->rt_type = res->type;
835 851
836 if (dev != NULL && rt->dst.neighbour == NULL) { 852 if (dev != NULL && dst_get_neighbour(&rt->dst) == NULL) {
837 n = __neigh_lookup_errno(&dn_neigh_table, &rt->rt_gateway, dev); 853 n = __neigh_lookup_errno(&dn_neigh_table, &rt->rt_gateway, dev);
838 if (IS_ERR(n)) 854 if (IS_ERR(n))
839 return PTR_ERR(n); 855 return PTR_ERR(n);
840 rt->dst.neighbour = n; 856 dst_set_neighbour(&rt->dst, n);
841 } 857 }
842 858
843 if (dst_metric(&rt->dst, RTAX_MTU) > rt->dst.dev->mtu) 859 if (dst_metric(&rt->dst, RTAX_MTU) > rt->dst.dev->mtu)
@@ -1144,7 +1160,7 @@ make_route:
1144 rt->rt_dst_map = fld.daddr; 1160 rt->rt_dst_map = fld.daddr;
1145 rt->rt_src_map = fld.saddr; 1161 rt->rt_src_map = fld.saddr;
1146 1162
1147 rt->dst.neighbour = neigh; 1163 dst_set_neighbour(&rt->dst, neigh);
1148 neigh = NULL; 1164 neigh = NULL;
1149 1165
1150 rt->dst.lastuse = jiffies; 1166 rt->dst.lastuse = jiffies;
@@ -1416,23 +1432,23 @@ make_route:
1416 rt->fld.flowidn_iif = in_dev->ifindex; 1432 rt->fld.flowidn_iif = in_dev->ifindex;
1417 rt->fld.flowidn_mark = fld.flowidn_mark; 1433 rt->fld.flowidn_mark = fld.flowidn_mark;
1418 1434
1419 rt->dst.neighbour = neigh; 1435 dst_set_neighbour(&rt->dst, neigh);
1420 rt->dst.lastuse = jiffies; 1436 rt->dst.lastuse = jiffies;
1421 rt->dst.output = dn_rt_bug; 1437 rt->dst.output = dn_rt_bug;
1422 switch(res.type) { 1438 switch (res.type) {
1423 case RTN_UNICAST: 1439 case RTN_UNICAST:
1424 rt->dst.input = dn_forward; 1440 rt->dst.input = dn_forward;
1425 break; 1441 break;
1426 case RTN_LOCAL: 1442 case RTN_LOCAL:
1427 rt->dst.output = dn_output; 1443 rt->dst.output = dn_output;
1428 rt->dst.input = dn_nsp_rx; 1444 rt->dst.input = dn_nsp_rx;
1429 rt->dst.dev = in_dev; 1445 rt->dst.dev = in_dev;
1430 flags |= RTCF_LOCAL; 1446 flags |= RTCF_LOCAL;
1431 break; 1447 break;
1432 default: 1448 default:
1433 case RTN_UNREACHABLE: 1449 case RTN_UNREACHABLE:
1434 case RTN_BLACKHOLE: 1450 case RTN_BLACKHOLE:
1435 rt->dst.input = dst_discard; 1451 rt->dst.input = dst_discard;
1436 } 1452 }
1437 rt->rt_flags = flags; 1453 rt->rt_flags = flags;
1438 1454
@@ -1841,10 +1857,11 @@ void __init dn_route_init(void)
1841 proc_net_fops_create(&init_net, "decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops); 1857 proc_net_fops_create(&init_net, "decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops);
1842 1858
1843#ifdef CONFIG_DECNET_ROUTER 1859#ifdef CONFIG_DECNET_ROUTER
1844 rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute, dn_fib_dump); 1860 rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute,
1861 dn_fib_dump, NULL);
1845#else 1862#else
1846 rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute, 1863 rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute,
1847 dn_cache_dump); 1864 dn_cache_dump, NULL);
1848#endif 1865#endif
1849} 1866}
1850 1867
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c
index bd0a52dd1d40..cd0354e9bdb3 100644
--- a/net/decnet/dn_table.c
+++ b/net/decnet/dn_table.c
@@ -147,17 +147,18 @@ static void dn_rehash_zone(struct dn_zone *dz)
147 147
148 old_divisor = dz->dz_divisor; 148 old_divisor = dz->dz_divisor;
149 149
150 switch(old_divisor) { 150 switch (old_divisor) {
151 case 16: 151 case 16:
152 new_divisor = 256; 152 new_divisor = 256;
153 new_hashmask = 0xFF; 153 new_hashmask = 0xFF;
154 break; 154 break;
155 default: 155 default:
156 printk(KERN_DEBUG "DECnet: dn_rehash_zone: BUG! %d\n", old_divisor); 156 printk(KERN_DEBUG "DECnet: dn_rehash_zone: BUG! %d\n",
157 case 256: 157 old_divisor);
158 new_divisor = 1024; 158 case 256:
159 new_hashmask = 0x3FF; 159 new_divisor = 1024;
160 break; 160 new_hashmask = 0x3FF;
161 break;
161 } 162 }
162 163
163 ht = kcalloc(new_divisor, sizeof(struct dn_fib_node*), GFP_KERNEL); 164 ht = kcalloc(new_divisor, sizeof(struct dn_fib_node*), GFP_KERNEL);
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c
index 64a7f39e069f..69975e0bcdea 100644
--- a/net/decnet/netfilter/dn_rtmsg.c
+++ b/net/decnet/netfilter/dn_rtmsg.c
@@ -69,15 +69,15 @@ static void dnrmg_send_peer(struct sk_buff *skb)
69 int group = 0; 69 int group = 0;
70 unsigned char flags = *skb->data; 70 unsigned char flags = *skb->data;
71 71
72 switch(flags & DN_RT_CNTL_MSK) { 72 switch (flags & DN_RT_CNTL_MSK) {
73 case DN_RT_PKT_L1RT: 73 case DN_RT_PKT_L1RT:
74 group = DNRNG_NLGRP_L1; 74 group = DNRNG_NLGRP_L1;
75 break; 75 break;
76 case DN_RT_PKT_L2RT: 76 case DN_RT_PKT_L2RT:
77 group = DNRNG_NLGRP_L2; 77 group = DNRNG_NLGRP_L2;
78 break; 78 break;
79 default: 79 default:
80 return; 80 return;
81 } 81 }
82 82
83 skb2 = dnrmg_build_message(skb, &status); 83 skb2 = dnrmg_build_message(skb, &status);
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
index 28f8b5e5f73b..02e75d11cfbb 100644
--- a/net/decnet/sysctl_net_decnet.c
+++ b/net/decnet/sysctl_net_decnet.c
@@ -68,14 +68,15 @@ static struct ctl_table_header *dn_table_header = NULL;
68static void strip_it(char *str) 68static void strip_it(char *str)
69{ 69{
70 for(;;) { 70 for(;;) {
71 switch(*str) { 71 switch (*str) {
72 case ' ': 72 case ' ':
73 case '\n': 73 case '\n':
74 case '\r': 74 case '\r':
75 case ':': 75 case ':':
76 *str = 0; 76 *str = 0;
77 case 0: 77 /* Fallthrough */
78 return; 78 case 0:
79 return;
79 } 80 }
80 str++; 81 str++;
81 } 82 }