diff options
Diffstat (limited to 'main/dahdi-linux-grsec')
-rw-r--r-- | main/dahdi-linux-grsec/APKBUILD | 14 | ||||
-rw-r--r-- | main/dahdi-linux-grsec/dahdi-2.5.0-bri-fixes.patch | 327 | ||||
-rw-r--r-- | main/dahdi-linux-grsec/dahdi-bri_dchan.patch | 70 | ||||
-rw-r--r-- | main/dahdi-linux-grsec/zaphfc-dahdi-2.5.0.patch | 36 |
4 files changed, 410 insertions, 37 deletions
diff --git a/main/dahdi-linux-grsec/APKBUILD b/main/dahdi-linux-grsec/APKBUILD index 54516c5936..5ffa547701 100644 --- a/main/dahdi-linux-grsec/APKBUILD +++ b/main/dahdi-linux-grsec/APKBUILD @@ -16,8 +16,8 @@ _realname=dahdi-linux pkgname=${_realname}-${_flavor} pkgver=$pkgver # when chaning _dahdiver we *must* bump _mypkgrel -_dahdiver=2.4.1.2 -_mypkgrel=2 +_dahdiver=2.5.0 +_mypkgrel=3 pkgrel=$(( $_kpkgrel + $_mypkgrel )) pkgdesc="Digium Asterisk Hardware Device Interface drivers $_dahdiver" url="http://www.asterisk.org" @@ -32,9 +32,11 @@ subpackages="$pkgname-dev" source="http://downloads.digium.com/pub/telephony/dahdi-linux/releases/${_realname}-$_dahdiver.tar.gz dahdi-depmod.patch dahdi-bri_dchan.patch + dahdi-2.5.0-bri-fixes.patch dahdi-zaphfc.patch zaphfc-dahdi-flortz.diff zaphfc-dahdi-2.4.0.patch + zaphfc-dahdi-2.5.0.patch " prepare() { @@ -75,9 +77,11 @@ dev() { ln -s /usr/include "$dir"/include } -md5sums="81b232a47693f4adac90c569e446f88f dahdi-linux-2.4.1.2.tar.gz +md5sums="449f6591ccedb68937b5b30cbd37cea3 dahdi-linux-2.5.0.tar.gz c78fb8d80f9efdffd950297c88ff9273 dahdi-depmod.patch -4b41a82ff390ac64c08092c5a3eab6a8 dahdi-bri_dchan.patch +3bb419ac598534cd4ad5248f23656001 dahdi-bri_dchan.patch +9088ee5cd24f94b7f90c24e5ed6071e0 dahdi-2.5.0-bri-fixes.patch a822c092f0548cd13f5e8d8cba053af6 dahdi-zaphfc.patch 291c5c44c86ab02443a742415461ddca zaphfc-dahdi-flortz.diff -0fdcd8c8c93bc1fe33c0af12b6cc6b05 zaphfc-dahdi-2.4.0.patch" +0fdcd8c8c93bc1fe33c0af12b6cc6b05 zaphfc-dahdi-2.4.0.patch +9ed23321512274c6c5c5b76af0411e38 zaphfc-dahdi-2.5.0.patch" diff --git a/main/dahdi-linux-grsec/dahdi-2.5.0-bri-fixes.patch b/main/dahdi-linux-grsec/dahdi-2.5.0-bri-fixes.patch new file mode 100644 index 0000000000..01dcf646fb --- /dev/null +++ b/main/dahdi-linux-grsec/dahdi-2.5.0-bri-fixes.patch @@ -0,0 +1,327 @@ +Index: dahdi-linux-2.5.0/drivers/dahdi/xpp/card_bri.c +=================================================================== +--- dahdi-linux-2.5.0.orig/drivers/dahdi/xpp/card_bri.c 2011-08-15 14:42:29.000000000 +0300 ++++ dahdi-linux-2.5.0/drivers/dahdi/xpp/card_bri.c 2011-08-15 14:51:37.000000000 +0300 +@@ -274,7 +274,6 @@ + int frame_begin; + + priv = xpd->priv; +- BUG_ON(!priv); + if(transmit) { + direction = "TX"; + frame_begin = priv->txframe_begin; +@@ -312,9 +311,7 @@ + { + struct BRI_priv_data *priv; + +- BUG_ON(!xpd); + priv = xpd->priv; +- BUG_ON(!priv); + if(priv->dchan_alive == up) + return; + if(up) { +@@ -332,9 +329,7 @@ + { + struct BRI_priv_data *priv; + +- BUG_ON(!xpd); + priv = xpd->priv; +- BUG_ON(!priv); + if(priv->layer1_up == up) + return; + priv->layer1_up = up; +@@ -348,9 +343,7 @@ + struct BRI_priv_data *priv; + byte curr_state; + +- BUG_ON(!xpd); + priv = xpd->priv; +- BUG_ON(!priv); + curr_state = priv->state_register.bits.v_su_sta; + XPD_DBG(SIGNAL, xpd, "%s\n", (on)?"ON":"OFF"); + if(on) { +@@ -391,9 +384,7 @@ + struct BRI_priv_data *priv; + byte curr_state; + +- BUG_ON(!xpd); + priv = xpd->priv; +- BUG_ON(!priv); + curr_state = priv->state_register.bits.v_su_sta; + XPD_DBG(SIGNAL, xpd, "%s\n", (on)?"ON":"OFF"); + if(on) { +@@ -443,7 +434,6 @@ + struct BRI_priv_data *priv; + + priv = xpd->priv; +- BUG_ON(!priv); + #ifdef CONFIG_DAHDI_BRI_DCHANS + if(debug & DBG_COMMANDS) + dump_hex_buf(xpd, "D-Chan(abort) RX: dchan_rbuf", +@@ -460,7 +450,6 @@ + byte status; + + priv = xpd->priv; +- BUG_ON(!priv); + #ifdef CONFIG_DAHDI_BRI_DCHANS + if(priv->dchan_r_idx < 4) { + XPD_NOTICE(xpd, "D-Chan RX short frame (dchan_r_idx=%d)\n", +@@ -503,7 +492,6 @@ + int idx; + + priv = xpd->priv; +- BUG_ON(!priv); + dchan_buf = dchan->readchunk; + idx = priv->dchan_r_idx; + if(idx + len >= DCHAN_BUFSIZE) { +@@ -527,7 +515,6 @@ + struct BRI_priv_data *priv; + + priv = xpd->priv; +- BUG_ON(!priv); + #ifdef CONFIG_DAHDI_BRI_DCHANS + dchan->bytes2receive = priv->dchan_r_idx - 1; + dchan->eofrx = 1; +@@ -556,10 +543,7 @@ + return 0; + if(!SPAN_REGISTERED(xpd)) /* Nowhere to copy data */ + return 0; +- BUG_ON(!xpd); + priv = xpd->priv; +- BUG_ON(!priv); +- xbus = xpd->xbus; + dchan = XPD_CHAN(xpd, 2); + if(!IS_OFFHOOK(xpd, 2)) { /* D-chan is used? */ + static int rate_limit; +@@ -629,9 +613,7 @@ + return 0; + if(!SPAN_REGISTERED(xpd)) /* Nowhere to copy data */ + return 0; +- BUG_ON(!xpd); + priv = xpd->priv; +- BUG_ON(!priv); + dchan = XPD_CHAN(xpd, 2); + if(!IS_OFFHOOK(xpd, 2)) { /* D-chan is used? */ + static int rate_limit; +@@ -677,7 +659,6 @@ + struct BRI_priv_data *priv; + + priv = xpd->priv; +- BUG_ON(!priv); + dchan = XPD_CHAN(xpd, 2); + if (dchan == chan) { + atomic_inc(&priv->hdlc_pending); +@@ -716,7 +697,6 @@ + int ret; + + priv = xpd->priv; +- BUG_ON(!priv); + #ifndef CONFIG_DAHDI_BRI_DCHANS + if(atomic_read(&priv->hdlc_pending) == 0) + return 0; +@@ -769,7 +749,6 @@ + { + struct BRI_priv_data *priv; + +- BUG_ON(!xpd); + priv = xpd->priv; + XPD_DBG(PROC, xpd, "\n"); + #ifdef CONFIG_PROC_FS +@@ -784,7 +763,6 @@ + { + struct BRI_priv_data *priv; + +- BUG_ON(!xpd); + priv = xpd->priv; + XPD_DBG(PROC, xpd, "\n"); + #ifdef CONFIG_PROC_FS +@@ -828,7 +806,6 @@ + { + struct BRI_priv_data *priv; + +- BUG_ON(!xpd); + XPD_DBG(GENERAL, xpd, "\n"); + priv = xpd->priv; + DO_LED(xpd, GREEN_LED, BRI_LED_OFF); +@@ -841,7 +818,6 @@ + + static int BRI_card_remove(xbus_t *xbus, xpd_t *xpd) + { +- BUG_ON(!xpd); + XPD_DBG(GENERAL, xpd, "\n"); + bri_proc_remove(xbus, xpd); + return 0; +@@ -877,10 +853,8 @@ + struct BRI_priv_data *priv; + int i; + +- BUG_ON(!xpd); + xbus = xpd->xbus; + priv = xpd->priv; +- BUG_ON(!xbus); + XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off"); + if(!on) { + /* Nothing to do yet */ +@@ -927,11 +901,6 @@ + + static int BRI_card_dahdi_postregistration(xpd_t *xpd, bool on) + { +- xbus_t *xbus; +- +- BUG_ON(!xpd); +- xbus = xpd->xbus; +- BUG_ON(!xbus); + XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off"); + return(0); + } +@@ -956,7 +925,6 @@ + int other_led; + int mod; + +- BUG_ON(!xpd); + if(IS_NT(xpd)) { + which_led = RED_LED; + other_led = GREEN_LED; +@@ -965,7 +933,6 @@ + other_led = RED_LED; + } + priv = xpd->priv; +- BUG_ON(!priv); + timer_count = xpd->timer_count; + if(xpd->blink_mode) { + if((timer_count % DEFAULT_LED_PERIOD) == 0) { +@@ -1014,9 +981,7 @@ + { + struct BRI_priv_data *priv; + +- BUG_ON(!xpd); + priv = xpd->priv; +- BUG_ON(!priv); + if(IS_NT(xpd)) { + if (priv->t1 > HFC_TIMER_OFF) { + if (--priv->t1 == 0) { +@@ -1053,9 +1018,7 @@ + { + struct BRI_priv_data *priv; + +- BUG_ON(!xpd); + priv = xpd->priv; +- BUG_ON(!priv); + if(!priv->initialized || !xbus->self_ticking) + return 0; + if(poll_interval != 0 && (priv->tick_counter % poll_interval) == 0) { +@@ -1111,7 +1074,6 @@ + + static int BRI_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long arg) + { +- BUG_ON(!xpd); + if(!XBUS_IS(xpd->xbus, READY)) + return -ENODEV; + switch (cmd) { +@@ -1131,7 +1093,6 @@ + + static int BRI_card_open(xpd_t *xpd, lineno_t pos) + { +- BUG_ON(!xpd); + if(pos == 2) { + LINE_DBG(SIGNAL, xpd, pos, "OFFHOOK the whole span\n"); + BIT_SET(PHONEDEV(xpd).offhook_state, 0); +@@ -1230,12 +1191,8 @@ + { + struct phonedev *phonedev = container_of(span, struct phonedev, span); + xpd_t *xpd = container_of(phonedev, struct xpd, phonedev); +- struct BRI_priv_data *priv; + struct dahdi_chan *dchan; + +- BUG_ON(!xpd); +- priv = xpd->priv; +- BUG_ON(!priv); + if(!XBUS_IS(xpd->xbus, READY)) { + XPD_DBG(GENERAL, xpd, "Startup called by dahdi. No Hardware. Ignored\n"); + return -ENODEV; +@@ -1267,11 +1224,7 @@ + { + struct phonedev *phonedev = container_of(span, struct phonedev, span); + xpd_t *xpd = container_of(phonedev, struct xpd, phonedev); +- struct BRI_priv_data *priv; + +- BUG_ON(!xpd); +- priv = xpd->priv; +- BUG_ON(!priv); + if(!XBUS_IS(xpd->xbus, READY)) { + XPD_DBG(GENERAL, xpd, "Shutdown called by dahdi. No Hardware. Ignored\n"); + return -ENODEV; +@@ -1292,7 +1245,6 @@ + xpd_t *main_xpd; + unsigned long flags; + +- BUG_ON(!xpd); + main_xpd = xpd_byaddr(xpd->xbus, xpd->addr.unit, 0); + if(!main_xpd) { + XPD_DBG(DEVICES, xpd, "Unit 0 is already gone. Ignore request\n"); +@@ -1350,8 +1302,6 @@ + xpp_line_t wanted_lines; + + +- BUG_ON(!xpd); +- BUG_ON(!pack); + pcm = RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, pcm); + for(subunit = 0; subunit < MAX_SUBUNIT; subunit++) { + xpd_t *tmp_xpd; +@@ -1435,12 +1385,8 @@ + + static int BRI_echocancel_setmask(xpd_t *xpd, xpp_line_t ec_mask) + { +- struct BRI_priv_data *priv; + int i; + +- BUG_ON(!xpd); +- priv = xpd->priv; +- BUG_ON(!priv); + XPD_DBG(GENERAL, xpd, "0x%8X\n", ec_mask); + if (!ECHOOPS(xpd->xbus)) { + XPD_DBG(GENERAL, xpd, +@@ -1466,9 +1412,7 @@ + struct bri_leds *bri_leds; + struct BRI_priv_data *priv; + +- BUG_ON(!xbus); + priv = xpd->priv; +- BUG_ON(!priv); + XPD_DBG(LEDS, xpd, "%s -> %d\n", + (which_led)?"RED":"GREEN", + to_led_state); +@@ -1507,9 +1451,7 @@ + struct BRI_priv_data *priv; + su_rd_sta_t new_state; + +- BUG_ON(!xpd); + priv = xpd->priv; +- BUG_ON(!priv); + if(!priv->initialized) { + XPD_ERR(xpd, "%s called on uninitialized AB\n", __FUNCTION__); + return; +@@ -1621,7 +1563,6 @@ + } + spin_lock_irqsave(&xpd->lock, flags); + priv = xpd->priv; +- BUG_ON(!priv); + if(REG_FIELD(info, do_subreg)) { + XPD_DBG(REGS, xpd, "RI %02X %02X %02X\n", + REG_FIELD(info, regnum), REG_FIELD(info, subreg), REG_FIELD(info, data_low)); +@@ -1665,7 +1606,6 @@ + { + struct BRI_priv_data *priv; + +- BUG_ON(!xpd); + priv = xpd->priv; + XPD_DBG(GENERAL, xpd, "%s\n", (on)?"ON":"OFF"); + if(on) { +@@ -1745,7 +1685,6 @@ + return -ENODEV; + spin_lock_irqsave(&xpd->lock, flags); + priv = xpd->priv; +- BUG_ON(!priv); + len += sprintf(page + len, "%05d Layer 1: ", priv->poll_counter); + if(priv->reg30_good) { + len += sprintf(page + len, "%-5s ", (priv->layer1_up) ? "UP" : "DOWN"); diff --git a/main/dahdi-linux-grsec/dahdi-bri_dchan.patch b/main/dahdi-linux-grsec/dahdi-bri_dchan.patch index d7a3fe859b..8d2ba97fd1 100644 --- a/main/dahdi-linux-grsec/dahdi-bri_dchan.patch +++ b/main/dahdi-linux-grsec/dahdi-bri_dchan.patch @@ -3,11 +3,13 @@ # Zaptel expects it as a standard channel with 1000 samples # per second. ---- a/include/dahdi/kernel.h -+++ b/include/dahdi/kernel.h -@@ -132,6 +132,13 @@ struct dahdi_chan { - int do_ppp_error; - struct sk_buff_head ppp_rq; +Index: dahdi-linux-2.5.0/include/dahdi/kernel.h +=================================================================== +--- dahdi-linux-2.5.0.orig/include/dahdi/kernel.h 2011-06-29 18:32:40.000000000 +0300 ++++ dahdi-linux-2.5.0/include/dahdi/kernel.h 2011-08-15 14:14:26.000000000 +0300 +@@ -413,6 +413,13 @@ + int statcount; + int lastnumbufs; #endif +#ifdef CONFIG_DAHDI_BRI_DCHANS + int bytes2receive; @@ -19,29 +21,31 @@ spinlock_t lock; char name[40]; /* Specified by DAHDI */ -@@ -462,6 +469,9 @@ enum { - DAHDI_FLAGBIT_LOOPED = 18, /*!< Loopback the receive data from the channel to the transmit */ - DAHDI_FLAGBIT_MTP2 = 19, /*!< Repeats last message in buffer and also discards repeating messages sent to us */ - DAHDI_FLAGBIT_HDLC56 = 20, /*!< Sets the given channel (if in HDLC mode) to use 56K HDLC instead of 64K */ +@@ -723,6 +730,9 @@ + DAHDI_FLAGBIT_TXUNDERRUN = 22, /*!< Transmit underrun condition */ + DAHDI_FLAGBIT_RXOVERRUN = 23, /*!< Receive overrun condition */ + DAHDI_FLAGBIT_DEVFILE = 25, /*!< Channel has a sysfs dev file */ +#if defined(CONFIG_DAHDI_BRI_DCHANS) -+ DAHDI_FLAGBIT_BRIDCHAN = 21, /*!< hardhdlc-like handling of the D channel */ ++ DAHDI_FLAGBIT_BRIDCHAN = 26, /*!< hardhdlc-like handling of the D channel */ +#endif }; - /* map flagbits to flag masks */ -@@ -500,6 +510,7 @@ enum { - #define DAHDI_FLAG_LOOPED DAHDI_FLAG(LOOPED) - #define DAHDI_FLAG_MTP2 DAHDI_FLAG(MTP2) - #define DAHDI_FLAG_HDLC56 DAHDI_FLAG(HDLC56) + #ifdef CONFIG_DAHDI_NET +@@ -789,6 +799,7 @@ + #define DAHDI_FLAG_BUFEVENTS DAHDI_FLAG(BUFEVENTS) + #define DAHDI_FLAG_TXUNDERRUN DAHDI_FLAG(TXUNDERRUN) + #define DAHDI_FLAG_RXOVERRUN DAHDI_FLAG(RXOVERRUN) +#define DAHDI_FLAG_BRIDCHAN DAHDI_FLAG(BRIDCHAN) - struct dahdi_span { - spinlock_t lock; ---- a/include/dahdi/dahdi_config.h -+++ b/include/dahdi/dahdi_config.h -@@ -174,4 +174,10 @@ + struct file; + +Index: dahdi-linux-2.5.0/include/dahdi/dahdi_config.h +=================================================================== +--- dahdi-linux-2.5.0.orig/include/dahdi/dahdi_config.h 2011-01-05 17:52:03.000000000 +0200 ++++ dahdi-linux-2.5.0/include/dahdi/dahdi_config.h 2011-08-15 14:13:01.000000000 +0300 +@@ -195,4 +195,10 @@ */ - /* #define OPTIMIZE_CHANMUTE */ + /* #define CONFIG_DAHDI_MIRROR */ +/* + * Uncomment the following for BRI D channels @@ -50,9 +54,11 @@ +#define CONFIG_DAHDI_BRI_DCHANS + #endif ---- a/drivers/dahdi/dahdi-base.c -+++ b/drivers/dahdi/dahdi-base.c -@@ -5907,11 +5907,40 @@ static inline void __dahdi_getbuf_chunk( +Index: dahdi-linux-2.5.0/drivers/dahdi/dahdi-base.c +=================================================================== +--- dahdi-linux-2.5.0.orig/drivers/dahdi/dahdi-base.c 2011-07-21 19:26:31.000000000 +0300 ++++ dahdi-linux-2.5.0/drivers/dahdi/dahdi-base.c 2011-08-15 14:13:01.000000000 +0300 +@@ -7224,11 +7224,40 @@ *(txb++) = fasthdlc_tx_run_nocheck(&ms->txhdlc); } bytes -= left; @@ -93,7 +99,7 @@ } /* Check buffer status */ if (ms->writeidx[ms->outwritebuf] >= ms->writen[ms->outwritebuf]) { -@@ -5968,6 +5997,17 @@ out in the later versions, and is put ba +@@ -7285,6 +7314,17 @@ /* Transmit a flag if this is an HDLC channel */ if (ms->flags & DAHDI_FLAG_HDLC) fasthdlc_tx_frame_nocheck(&ms->txhdlc); @@ -109,11 +115,11 @@ + } +#endif #ifdef CONFIG_DAHDI_NET - if (ms->flags & DAHDI_FLAG_NETDEV) - netif_wake_queue(ztchan_to_dev(ms)); -@@ -6028,6 +6068,12 @@ out in the later versions, and is put ba - memset(txb, 0xFF, bytes); + if (dahdi_have_netdev(ms)) + netif_wake_queue(chan_to_netdev(ms)); +@@ -7346,6 +7386,12 @@ } + needtxunderrun += bytes; bytes = 0; +#if defined(CONFIG_DAHDI_BRI_DCHANS) + } else if (test_bit(DAHDI_FLAGBIT_BRIDCHAN, &ms->flags)) { @@ -123,8 +129,8 @@ +#endif } else { memset(txb, DAHDI_LIN2X(0, ms), bytes); /* Lastly we use silence on telephony channels */ - bytes = 0; -@@ -6840,6 +6886,14 @@ static inline void __putbuf_chunk(struct + needtxunderrun += bytes; +@@ -8267,6 +8313,14 @@ int res; int left, x; @@ -139,7 +145,7 @@ while(bytes) { #if defined(CONFIG_DAHDI_NET) || defined(CONFIG_DAHDI_PPP) skb = NULL; -@@ -6897,6 +6951,19 @@ static inline void __putbuf_chunk(struct +@@ -8324,6 +8378,19 @@ } } } diff --git a/main/dahdi-linux-grsec/zaphfc-dahdi-2.5.0.patch b/main/dahdi-linux-grsec/zaphfc-dahdi-2.5.0.patch new file mode 100644 index 0000000000..37a1e76ba8 --- /dev/null +++ b/main/dahdi-linux-grsec/zaphfc-dahdi-2.5.0.patch @@ -0,0 +1,36 @@ +Index: dahdi-linux-2.5.0/drivers/dahdi/zaphfc.c +=================================================================== +--- dahdi-linux-2.5.0.orig/drivers/dahdi/zaphfc.c 2011-08-15 14:29:51.000000000 +0300 ++++ dahdi-linux-2.5.0/drivers/dahdi/zaphfc.c 2011-08-15 14:30:11.000000000 +0300 +@@ -616,7 +616,7 @@ + return 0; + } + +-static int zthfc_startup(struct dahdi_span *span) { ++static int zthfc_startup(struct file *file, struct dahdi_span *span) { + struct dahdi_hfc *zthfc = container_of(span, struct dahdi_hfc, span); + struct hfc_card *hfctmp = zthfc->card; + int alreadyrunning; +@@ -653,12 +653,12 @@ + return 0; + } + +-static int zthfc_chanconfig(struct dahdi_chan *chan, int sigtype) { ++static int zthfc_chanconfig(struct file *file, struct dahdi_chan *chan, int sigtype) { + // printk(KERN_CRIT "chan_config sigtype=%d\n", sigtype); + return 0; + } + +-static int zthfc_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc) { ++static int zthfc_spanconfig(struct file *file, struct dahdi_span *span, struct dahdi_lineconfig *lc) { + span->lineconfig = lc->lineconfig; + return 0; + } +@@ -699,7 +699,6 @@ + zthfc->span.deflaw = DAHDI_LAW_ALAW; + zthfc->span.linecompat = DAHDI_CONFIG_AMI | DAHDI_CONFIG_CCS; // <--- this is really BS + zthfc->span.offset = 0; +- init_waitqueue_head(&zthfc->span.maintq); + + for (i = 0; i < zthfc->span.channels; i++) { + memset(&(zthfc->chans[i]), 0x0, sizeof(struct dahdi_chan)); |