]> git.ozlabs.org Git - ppp.git/commitdiff
Merge branch 'master' of git://github.com/cmcqueen/ppp
authorPaul Mackerras <paulus@samba.org>
Fri, 1 Aug 2014 11:41:27 +0000 (21:41 +1000)
committerPaul Mackerras <paulus@samba.org>
Fri, 1 Aug 2014 11:41:27 +0000 (21:41 +1000)
This merges in one commit, which adds the new "stop-bits" option.

Signed-off-by: Paul Mackerras <paulus@samba.org>
1  2 
pppd/pppd.h
pppd/sys-linux.c

diff --combined pppd/pppd.h
index 7c341006bc18ce28b9707253db42089b803d4902,873b832598f7351c8aece87d09bcc5fced68ec68..247fa153739b387d217719e6ac1beb8bf407d708
@@@ -279,6 -279,7 +279,7 @@@ extern int kdebugflag;     /* Tell kernel t
  extern int    default_device; /* Using /dev/tty or equivalent */
  extern char   devnam[MAXPATHLEN];     /* Device name */
  extern int    crtscts;        /* Use hardware flow control */
+ extern int    stop_bits;      /* Number of serial port stop bits */
  extern bool   modem;          /* Use modem control lines */
  extern int    inspeed;        /* Input/Output speed requested */
  extern u_int32_t netmask;     /* IP netmask to set on interface */
@@@ -657,8 -658,6 +658,8 @@@ int  cifaddr __P((int, u_int32_t, u_int
                                /* Reset i/f IP addresses */
  #ifdef INET6
  int  ether_to_eui64(eui64_t *p_eui64);        /* convert eth0 hw address to EUI64 */
 +int  sif6up __P((int));               /* Configure i/f up for IPv6 */
 +int  sif6down __P((int));     /* Configure i/f down for IPv6 */
  int  sif6addr __P((int, eui64_t, eui64_t));
                                /* Configure IPv6 addresses for i/f */
  int  cif6addr __P((int, eui64_t, eui64_t));
diff --combined pppd/sys-linux.c
index a40d00c1926908575f1e12a23d35bec32d6596e6,163f5618582c109fd68c45d0b8392a745b44d234..e5e9baf8821ff775305a7681441634a0f1bb97c3
@@@ -205,7 -205,6 +205,7 @@@ static char loop_name[20]
  static unsigned char inbuf[512]; /* buffer for chars read from loopback */
  
  static int    if_is_up;       /* Interface has been marked up */
 +static int    if6_is_up;      /* Interface has been marked up for IPv6, to help differentiate */
  static int    have_default_route;     /* Gateway for default route added */
  static u_int32_t proxy_arp_addr;      /* Addr for proxy arp entry added */
  static char proxy_arp_dev[16];                /* Device for proxy arp entry */
@@@ -240,7 -239,6 +240,7 @@@ static void decode_version (char *buf, 
  static int set_kdebugflag(int level);
  static int ppp_registered(void);
  static int make_ppp_unit(void);
 +static int setifstate (int u, int state);
  
  extern u_char inpacket_buf[]; /* borrowed from main.c */
  
@@@ -340,9 -338,6 +340,9 @@@ void sys_cleanup(void
        if_is_up = 0;
        sifdown(0);
      }
 +    if (if6_is_up)
 +      sif6down(0);
 +
  /*
   * Delete any routes through the device.
   */
@@@ -971,6 -966,9 +971,9 @@@ void set_up_tty(int tty_fd, int local
        break;
      }
  
+     if (stop_bits >= 2)
+       tios.c_cflag |= CSTOPB;
      speed = translate_speed(inspeed);
      if (speed) {
        cfsetospeed (&tios, speed);
@@@ -2257,12 -2255,25 +2260,12 @@@ int sifvjcomp (int u, int vjcomp, int c
  
  int sifup(int u)
  {
 -    struct ifreq ifr;
 -
 -    memset (&ifr, '\0', sizeof (ifr));
 -    strlcpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
 -    if (ioctl(sock_fd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
 -      if (! ok_error (errno))
 -          error("ioctl (SIOCGIFFLAGS): %m (line %d)", __LINE__);
 -      return 0;
 -    }
 +    int ret;
  
 -    ifr.ifr_flags |= (IFF_UP | IFF_POINTOPOINT);
 -    if (ioctl(sock_fd, SIOCSIFFLAGS, (caddr_t) &ifr) < 0) {
 -      if (! ok_error (errno))
 -          error("ioctl(SIOCSIFFLAGS): %m (line %d)", __LINE__);
 -      return 0;
 -    }
 -    if_is_up++;
 +    if ((ret = setifstate(u, 1)))
 +      if_is_up++;
  
 -    return 1;
 +    return ret;
  }
  
  /********************************************************************
  
  int sifdown (int u)
  {
 -    struct ifreq ifr;
 -
      if (if_is_up && --if_is_up > 0)
        return 1;
  
 +#ifdef INET6
 +    if (if6_is_up)
 +      return 1;
 +#endif /* INET6 */
 +
 +    return setifstate(u, 0);
 +}
 +
 +#ifdef INET6
 +/********************************************************************
 + *
 + * sif6up - Config the interface up for IPv6
 + */
 +
 +int sif6up(int u)
 +{
 +    int ret;
 +
 +    if ((ret = setifstate(u, 1)))
 +      if6_is_up = 1;
 +
 +    return ret;
 +}
 +
 +/********************************************************************
 + *
 + * sif6down - Disable the IPv6CP protocol and config the interface
 + *          down if there are no remaining protocols.
 + */
 +
 +int sif6down (int u)
 +{
 +    if6_is_up = 0;
 +
 +    if (if_is_up)
 +      return 1;
 +
 +    return setifstate(u, 0);
 +}
 +#endif /* INET6 */
 +
 +/********************************************************************
 + *
 + * setifstate - Config the interface up or down
 + */
 +
 +static int setifstate (int u, int state)
 +{
 +    struct ifreq ifr;
 +
      memset (&ifr, '\0', sizeof (ifr));
      strlcpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
      if (ioctl(sock_fd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
        return 0;
      }
  
 -    ifr.ifr_flags &= ~IFF_UP;
 +    if (state)
 +      ifr.ifr_flags |= IFF_UP;
 +    else
 +      ifr.ifr_flags &= ~IFF_UP;
      ifr.ifr_flags |= IFF_POINTOPOINT;
      if (ioctl(sock_fd, SIOCSIFFLAGS, (caddr_t) &ifr) < 0) {
        if (! ok_error (errno))