Skip to content

Commit

Permalink
Flush routes _before_ adding the IP
Browse files Browse the repository at this point in the history
  • Loading branch information
aw committed Feb 22, 2018
1 parent 8f0e05e commit 4288ea3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.9.0 (2018-02-22)

* [bugfix] IPv6 routes should be removed before configuring the IP, not after

## 1.8.0 (2017-11-21)

* Display 'Failed' if the IP or NTP configuration fails
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2016 Alexander Williams, Unscramble <license@unscramble.jp>
Copyright (c) 2015-2018 Alexander Williams, Unscramble <license@unscramble.jp>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions module.l
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[de MODULE_INFO
("name" "tinycore-network")
("version" "1.8.0")
("version" "1.9.0")
("summary" "TinyCore static/dhcp networking")
("source" "https://a1w.ca")
("author" "Alexander Williams")
("license" "MIT")
("copyright" "(c) 2015-2017 Alexander Williams, Unscramble <license@unscramble.jp>") ]
("copyright" "(c) 2015-2018 Alexander Williams, Unscramble <license@unscramble.jp>") ]
4 changes: 2 additions & 2 deletions network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# TinyCore static/dhcp networking
#
# MIT License
# Copyright (c) 2015-2017 Alexander Williams, Unscramble <license@unscramble.jp>
# Copyright (c) 2015-2018 Alexander Williams, Unscramble <license@unscramble.jp>
#
# VERSION: 1.8.0
# VERSION: 1.9.0

. /etc/init.d/tc-functions
set -a
Expand Down
16 changes: 9 additions & 7 deletions udhcpc.script
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ case "$1" in
;;

renew|bound)
# flush routes first
if [ -n "$router" ] ; then
echo "deleting routers"
while route del default gw 0.0.0.0 dev $interface ; do
:
done
[ -n "$subnet_ipv6" ] && $IP_COMMAND -6 route flush dev $interface
fi

echo "adding ip $ip"
if [ -n "$subnet_ipv6" ]; then
$IP_COMMAND -6 addr add ${ip}${subnet_ipv6} dev $interface
Expand All @@ -30,13 +39,6 @@ case "$1" in
/sbin/ifconfig $interface | grep -q "inet addr"

if [ -n "$router" ] ; then
echo "deleting routers"
while route del default gw 0.0.0.0 dev $interface ; do
:
done

[ -n "$subnet_ipv6" ] && $IP_COMMAND -6 route flush dev $interface

metric=0
for i in $router ; do
echo "adding routers $i"
Expand Down

0 comments on commit 4288ea3

Please sign in to comment.