* Enqueue transmit packet. */
| 769 | * Enqueue transmit packet. |
| 770 | */ |
| 771 | static int |
| 772 | sppp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, |
| 773 | struct route *ro) |
| 774 | { |
| 775 | struct sppp *sp = IFP2SP(ifp); |
| 776 | struct ppp_header *h; |
| 777 | struct ifqueue *ifq = NULL; |
| 778 | int error, rv = 0; |
| 779 | #ifdef INET |
| 780 | int ipproto = PPP_IP; |
| 781 | #endif |
| 782 | int debug = ifp->if_flags & IFF_DEBUG; |
| 783 | |
| 784 | SPPP_LOCK(sp); |
| 785 | |
| 786 | if (!(ifp->if_flags & IFF_UP) || |
| 787 | (!(ifp->if_flags & IFF_AUTO) && |
| 788 | !(ifp->if_drv_flags & IFF_DRV_RUNNING))) { |
| 789 | #ifdef INET6 |
| 790 | drop: |
| 791 | #endif |
| 792 | m_freem (m); |
| 793 | SPPP_UNLOCK(sp); |
| 794 | return (ENETDOWN); |
| 795 | } |
| 796 | |
| 797 | if ((ifp->if_flags & IFF_AUTO) && |
| 798 | !(ifp->if_drv_flags & IFF_DRV_RUNNING)) { |
| 799 | #ifdef INET6 |
| 800 | /* |
| 801 | * XXX |
| 802 | * |
| 803 | * Hack to prevent the initialization-time generated |
| 804 | * IPv6 multicast packet to erroneously cause a |
| 805 | * dialout event in case IPv6 has been |
| 806 | * administratively disabled on that interface. |
| 807 | */ |
| 808 | if (dst->sa_family == AF_INET6 && |
| 809 | !(sp->confflags & CONF_ENABLE_IPV6)) |
| 810 | goto drop; |
| 811 | #endif |
| 812 | /* |
| 813 | * Interface is not yet running, but auto-dial. Need |
| 814 | * to start LCP for it. |
| 815 | */ |
| 816 | ifp->if_drv_flags |= IFF_DRV_RUNNING; |
| 817 | lcp.Open(sp); |
| 818 | } |
| 819 | |
| 820 | #ifdef INET |
| 821 | if (dst->sa_family == AF_INET) { |
| 822 | /* XXX Check mbuf length here? */ |
| 823 | struct ip *ip = mtod (m, struct ip*); |
| 824 | struct tcphdr *tcp = (struct tcphdr*) ((long*)ip + ip->ip_hl); |
| 825 | |
| 826 | /* |
| 827 | * When using dynamic local IP address assignment by using |
| 828 | * 0.0.0.0 as a local address, the first TCP session will |
nothing calls this directly
no test coverage detected