-
Notifications
You must be signed in to change notification settings - Fork 2
Bug fixes and inverting some logic #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5969fb1
e7722b1
59d81c1
dbc2074
d7635cc
f0cd906
af989be
67b0408
2a7b9b1
b76d112
6a02ce1
00130e8
d38ce68
164558f
183ca6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,17 +30,18 @@ while true; do | |
| echo $pinterface is one we should be checking | ||
| # Check to see if we need to update the config file | ||
| echo Checking MTU for $pinterface | ||
| pmtu=$(grep $(($PTARGET-8)) /etc/ppp/peers/$pinterface) | ||
| pmtu=$(grep 'mtu $(($PTARGET))' /etc/ppp/peers/$pinterface) | ||
| if [[ $pmtu ]]; then | ||
| echo MTU already correct in /etc/ppp/peers/$pinterface | ||
| pmtucorrect=1 | ||
| else | ||
| echo Current config file MTU for $pinterface is $pmtu | ||
| echo Updating config file for $pinterface | ||
| echo Making changes to /etc/ppp/peers/$pinterface | ||
| # Update MTU in ppp interface config file | ||
| sed -i 's/ '$(($PTARGET-8))'/ '$PTARGET'/g' /etc/ppp/peers/$pinterface | ||
| killall -SIGHUP pppd | ||
| else | ||
| echo MTU already correct in /etc/ppp/peers/$pinterface | ||
| pmtucorrect=1 | ||
| sed -i 's/mtu\s[0-9]*/mtu '$PTARGET'/g' /etc/ppp/peers/$pinterface | ||
| sed -i 's/mru\s[0-9]*/mru '$PTARGET'/g' /etc/ppp/peers/$pinterface | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of doing a ptarget-8 replacement i changed this to replace the number value of mtu and mru lines individually no matter what value they have. for aforementioned ptarget-8 problems |
||
| restartpppd=1 | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i noticed when using this script that the ppp0 interface would have the wrong value after it worked, but the config would be correct. i realized it was because this was happening too soon, it needs to happen after the eth interface is updated. so i just set restartpppd=1 here and have pppd restart later instead of right away |
||
| fi | ||
| # Determine eth interface associated with ppp interface | ||
| einterface=$(sed -n 's/plugin rp-pppoe.so \(.*\)/\1/p' /etc/ppp/peers/$pinterface) | ||
|
|
@@ -50,7 +51,10 @@ while true; do | |
| echo Got $emtu for $einterface | ||
| # Current ethernet MTU is incorrect so needs changing | ||
| echo Checking $einterface | ||
| if [[ $emtu -lt $(($PTARGET+8)) ]] ; then | ||
| if [[ $emtu -eq $(($PTARGET)) ]] ; then | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed this to look for the correct rather than the incorrect but that incorrect is not always right. it would only be right if you were trying to increase the mtu rather than decrease. which is what i want to do. so this works for both |
||
| echo $einterface has right MTU | ||
| emtucorrect=1 | ||
| else | ||
| echo $einterface has wrong MTU | ||
| # Use +12 in above command if PPPoE over VLAN | ||
| echo Reconfiguring ethernet MTU to $(($PTARGET+8)) for $einterface | ||
|
|
@@ -62,10 +66,7 @@ while true; do | |
| # ip link set dev $einterface mtu $(($PTARGET+12)) && ip link set dev $einterface.6 mtu $(($PTARGET+8)) | ||
| # Bring interface down and up to apply changes | ||
| echo Running ip link set $einterface down \&\& ip link set $einterface up | ||
| ip link set $einterface down && ip link set $einterface up | ||
| else | ||
| echo $einterface has right MTU | ||
| emtucorrect=1 | ||
| ip link set $einterface down && ip link set $einterface up | ||
| fi | ||
| # A situation can occur where all the configuration files are correct | ||
| # but the ppp interface is still not right | ||
|
|
@@ -74,14 +75,14 @@ while true; do | |
| if [ $pmtucorrect -eq 1 ] && [ $emtucorrect -eq 1 ]; then | ||
| # Config files are all correct | ||
| echo Config files are now all set correctly | ||
| runningmtu=$(ip link list | grep $pinterface | grep $(($PTARGET-8))) | ||
| if [ ! -z $runningmtu ]; then | ||
| runningmtu=$(ip link list | grep $pinterface | grep $(($PTARGET))) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. get rid of the -8 check here and look for if it doesnt have the correct value instead of it having the specific wrong value |
||
| if [ -z $runningmtu ]; then | ||
| echo $pinterface still has wrong MTU | ||
| restartpppd=1 | ||
| fi | ||
| fi | ||
| fi | ||
| done | ||
| done | ||
| if [[ $restartpppd == 1 ]]; then | ||
| echo Killing pppd | ||
| killall -SIGHUP pppd | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look for mtu 1500 or whatever the PTARGET is instead of just PTARGET-8 (1492) because there is no guarantee that will actually be the value. also if someone has other changes with the same number somewhere else in this file that would cause problems. so i changed it to look for exactly the target mtu value. i assumed the mru would be the same which i think is fine.
I also made it look for the correct rather than the wrong because ptarget-8 is never going to be true if you have a ptarget of like 1444