if_gif.c (138d56556ca1e2abd4f4b7ed860e8cbb11597b83) | if_gif.c (245c40e879bf77ed018b550185412cf861bd6c1d) |
---|---|
1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 730 unchanged lines hidden (view full) --- 739 sc = ifp->if_softc; 740 if (sc == NULL) { 741 error = ENXIO; 742 goto bad; 743 } 744 error = 0; 745 switch (cmd) { 746 case SIOCSIFPHYADDR: | 1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 730 unchanged lines hidden (view full) --- 739 sc = ifp->if_softc; 740 if (sc == NULL) { 741 error = ENXIO; 742 goto bad; 743 } 744 error = 0; 745 switch (cmd) { 746 case SIOCSIFPHYADDR: |
747#ifdef INET6 |
|
747 case SIOCSIFPHYADDR_IN6: | 748 case SIOCSIFPHYADDR_IN6: |
749#endif |
|
748 error = EINVAL; 749 switch (cmd) { 750#ifdef INET 751 case SIOCSIFPHYADDR: 752 src = (struct sockaddr *) 753 &(((struct in_aliasreq *)data)->ifra_addr); 754 dst = (struct sockaddr *) 755 &(((struct in_aliasreq *)data)->ifra_dstaddr); --- 79 unchanged lines hidden (view full) --- 835 }; 836 error = gif_set_tunnel(ifp, src, dst); 837 break; 838 case SIOCDIFPHYADDR: 839 gif_delete_tunnel(ifp); 840 break; 841 case SIOCGIFPSRCADDR: 842 case SIOCGIFPDSTADDR: | 750 error = EINVAL; 751 switch (cmd) { 752#ifdef INET 753 case SIOCSIFPHYADDR: 754 src = (struct sockaddr *) 755 &(((struct in_aliasreq *)data)->ifra_addr); 756 dst = (struct sockaddr *) 757 &(((struct in_aliasreq *)data)->ifra_dstaddr); --- 79 unchanged lines hidden (view full) --- 837 }; 838 error = gif_set_tunnel(ifp, src, dst); 839 break; 840 case SIOCDIFPHYADDR: 841 gif_delete_tunnel(ifp); 842 break; 843 case SIOCGIFPSRCADDR: 844 case SIOCGIFPDSTADDR: |
845#ifdef INET6 |
|
843 case SIOCGIFPSRCADDR_IN6: 844 case SIOCGIFPDSTADDR_IN6: | 846 case SIOCGIFPSRCADDR_IN6: 847 case SIOCGIFPDSTADDR_IN6: |
848#endif |
|
845 if (sc->gif_family == 0) { 846 error = EADDRNOTAVAIL; 847 break; 848 } 849 GIF_RLOCK(sc); 850 switch (cmd) { 851#ifdef INET 852 case SIOCGIFPSRCADDR: --- 199 unchanged lines hidden (view full) --- 1052 error = gif_attach(sc, src->sa_family); 1053 1054 GIF_WLOCK(sc); 1055 if (sc->gif_family != 0) 1056 free(sc->gif_hdr, M_GIF); 1057 sc->gif_family = src->sa_family; 1058 sc->gif_hdr = hdr; 1059 GIF_WUNLOCK(sc); | 849 if (sc->gif_family == 0) { 850 error = EADDRNOTAVAIL; 851 break; 852 } 853 GIF_RLOCK(sc); 854 switch (cmd) { 855#ifdef INET 856 case SIOCGIFPSRCADDR: --- 199 unchanged lines hidden (view full) --- 1056 error = gif_attach(sc, src->sa_family); 1057 1058 GIF_WLOCK(sc); 1059 if (sc->gif_family != 0) 1060 free(sc->gif_hdr, M_GIF); 1061 sc->gif_family = src->sa_family; 1062 sc->gif_hdr = hdr; 1063 GIF_WUNLOCK(sc); |
1064#if defined(INET) || defined(INET6) |
|
1060bad: | 1065bad: |
1066#endif |
|
1061 if (error == 0 && sc->gif_family != 0) 1062 ifp->if_drv_flags |= IFF_DRV_RUNNING; 1063 else 1064 ifp->if_drv_flags &= ~IFF_DRV_RUNNING; 1065 return (error); 1066} 1067 1068static void --- 18 unchanged lines hidden --- | 1067 if (error == 0 && sc->gif_family != 0) 1068 ifp->if_drv_flags |= IFF_DRV_RUNNING; 1069 else 1070 ifp->if_drv_flags &= ~IFF_DRV_RUNNING; 1071 return (error); 1072} 1073 1074static void --- 18 unchanged lines hidden --- |