-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from Lemon080910/updatewanip
增加1000-esw_rt3052-update-wan-ip.patchwan口热插拔时更新ip
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
target/linux/ramips/patches-3.18/1000-esw_rt3052-update-wan-ip.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Index: linux-3.18.29/drivers/net/ethernet/ralink/esw_rt3052.c | ||
=================================================================== | ||
--- linux-3.18.29.orig/drivers/net/ethernet/ralink/esw_rt3052.c | ||
+++ linux-3.18.29/drivers/net/ethernet/ralink/esw_rt3052.c | ||
@@ -444,8 +444,36 @@ static void esw_set_gsc(struct rt305x_es | ||
|
||
static int esw_apply_config(struct switch_dev *dev); | ||
|
||
+struct work_struct kill_sig_wq; | ||
+ | ||
+void kill_sig_workq(struct work_struct *work) | ||
+{ | ||
+ dev_info(NULL, "kill_sig_workq\n"); | ||
+ struct file *fp; | ||
+ char pid[8]; | ||
+ struct task_struct *p = NULL; | ||
+ //read udhcpc pid from file, and send signal USR2,USR1 to get a new IP | ||
+ fp = filp_open("/var/run/udhcpc-eth0.2.pid", O_RDONLY, 0); | ||
+ if (IS_ERR(fp)){ | ||
+ return; | ||
+ } | ||
+ | ||
+ if (fp->f_op && fp->f_op->read) { | ||
+ if (fp->f_op->read(fp, pid, 8, &fp->f_pos) > 0) { | ||
+ p = pid_task(find_get_pid(simple_strtoul(pid, NULL, 10)), PIDTYPE_PID); | ||
+ if (NULL != p) { | ||
+ send_sig(SIGUSR2, p, 0); | ||
+ send_sig(SIGUSR1, p, 0); | ||
+ } | ||
+ } | ||
+ } | ||
+ filp_close(fp, NULL); | ||
+ | ||
+} | ||
+ | ||
static void esw_hw_init(struct rt305x_esw *esw) | ||
{ | ||
+ INIT_WORK(&kill_sig_wq, kill_sig_workq); | ||
int i; | ||
u8 port_disable = 0; | ||
u8 port_map = RT305X_ESW_PMAP_LLLLLL; | ||
@@ -734,6 +762,7 @@ static irqreturn_t esw_interrupt(int irq | ||
link >>= RT305X_ESW_POA_LINK_SHIFT; | ||
link &= RT305X_ESW_POA_LINK_MASK; | ||
dev_info(esw->dev, "link changed 0x%02X\n", link); | ||
+ schedule_work(&kill_sig_wq); | ||
} | ||
esw_w32(esw, status, RT305X_ESW_REG_ISR); | ||
|