- if (ioctl(ppp_dev_fd, PPPIOCATTACH, &ifnum) < 0) {
- error("Couldn't attach to interface unit %d: %m\n", ifnum);
- return -1;
- }
- set_flags(ppp_dev_fd, get_flags(ppp_dev_fd) | SC_MULTILINK);
- if (ioctl(ppp_dev_fd, PPPIOCSMRRU, &mrru) < 0)
- error("Couldn't set interface MRRU: %m");
+/*
+ * make_new_bundle - create a new PPP unit (i.e. a bundle)
+ * and connect our channel to it. This should only get called
+ * if `multilink' was set at the time establish_ppp was called.
+ */
+void make_new_bundle(int mrru, int mtru, int rssn, int tssn)
+{
+ int flags;
+ struct ifreq ifr;
+
+ if (looped || !new_style_driver)
+ return;
+ dbglog("make_new_bundle(%d,%d,%d,%d)", mrru, mtru, rssn, tssn);
+
+ /* make us a ppp unit */
+ if (make_ppp_unit() < 0)
+ die(1);
+
+ /* set the mrru, mtu and flags */
+ if (ioctl(ppp_dev_fd, PPPIOCSMRRU, &mrru) < 0)
+ error("Couldn't set MRRU: %m");
+ flags = get_flags(ppp_dev_fd);
+ flags &= ~(SC_MP_SHORTSEQ | SC_MP_XSHORTSEQ);
+ flags |= (rssn? SC_MP_SHORTSEQ: 0) | (tssn? SC_MP_XSHORTSEQ: 0);
+
+ if (mtru > 0 && mtru != link_mtu) {
+ memset(&ifr, 0, sizeof(ifr));
+ slprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "ppp%d", ifunit);
+ ifr.ifr_mtu = mtru;
+ if (ioctl(sock_fd, SIOCSIFMTU, &ifr) < 0)
+ error("Couldn't set interface MTU: %m");
+ flags |= SC_MULTILINK;
+ }