Partially enable DHCP and fix some 2015 protocol bugs.

This commit is contained in:
Patrick Fairbank
2016-08-28 18:46:33 -07:00
parent 56b0953bc5
commit a0fcf215ee
4 changed files with 64 additions and 4 deletions

View File

@@ -284,6 +284,7 @@ interface GigabitEthernet0.15
interface GigabitEthernet0.16
encapsulation dot1Q 16
ip access-group 100 in
ip access-group 101 out
no ip route-cache
bridge-group 16
bridge-group 16 spanning-disabled
@@ -300,6 +301,8 @@ no ip http secure-server
ip http help-path http://www.cisco.com/warp/public/779/smbiz/prodconfig/help/eag
access-list 100 deny udp any any eq 1120
access-list 100 permit ip any any
access-list 101 deny tcp any any eq 1750
access-list 101 permit ip any any
!
bridge 1 route ip
!

View File

@@ -38,9 +38,20 @@ func ConfigureTeamEthernet(red1, red2, red3, blue1, blue2, blue3 *Team) error {
if oldTeamVlans[team.Id] == vlan {
delete(oldTeamVlans, team.Id)
} else {
addTeamVlansCommand += fmt.Sprintf("no access-list 1%d\naccess-list 1%d permit ip "+
"10.%d.%d.0 0.0.0.255 host %s\ninterface Vlan%d\nip address 10.%d.%d.61 255.255.255.0\n", vlan,
vlan, team.Id/100, team.Id%100, driverStationTcpListenAddress, vlan, team.Id/100, team.Id%100)
addTeamVlansCommand += fmt.Sprintf(
"ip dhcp excluded-address 10.%d.%d.1 10.%d.%d.100\n"+
"no ip dhcp pool dhcp%d\n"+
"ip dhcp pool dhcp%d\n"+
"network 10.%d.%d.0 255.255.255.0\n"+
"default-router 10.%d.%d.61\n"+
"lease 7\n"+
"no access-list 1%d\n"+
"access-list 1%d permit ip 10.%d.%d.0 0.0.0.255 host %s\n"+
"access-list 1%d permit udp any eq bootpc any eq bootps\n"+
"interface Vlan%d\nip address 10.%d.%d.61 255.255.255.0\n",
team.Id/100, team.Id%100, team.Id/100, team.Id%100, vlan, vlan, team.Id/100, team.Id%100, team.Id/100,
team.Id%100, vlan, vlan, team.Id/100, team.Id%100, driverStationTcpListenAddress, vlan, vlan,
team.Id/100, team.Id%100)
}
}
replaceTeamVlan(red1, red1Vlan)

View File

@@ -16,6 +16,7 @@ const (
driverStationTcpListenPort = 1750
driverStationUdpSendPort = 1120
driverStationLinkTimeoutSec = 5
robotLinkTimeoutSec = 1
maxTcpPacketBytes = 4096
)
@@ -206,7 +207,9 @@ func (dsConn *DriverStationConnection) sendControlPacket() error {
func (dsConn *DriverStationConnection) decodeStatusPacket(data [36]byte) {
if data[6]&0x01 != 0 && data[6]&0x08 == 0 {
// Robot is not connected.
dsConn.RobotLinked = false
if time.Since(dsConn.lastRobotLinkedTime).Seconds() > robotLinkTimeoutSec {
dsConn.RobotLinked = false
}
return
}
@@ -301,6 +304,7 @@ func (dsConn *DriverStationConnection) handleTcpConnection() {
if err != nil {
fmt.Printf("Error reading from connection for Team %d: %v\n", dsConn.TeamId, err.Error())
dsConn.Close()
mainArena.AllianceStations[dsConn.AllianceStation].DsConn = nil
break
}

View File

@@ -14,6 +14,12 @@ enable secret 5 $1$kKSW$fCMwnMdYvXui1TulfyYHN/
ip subnet-zero
ip routing
ip dhcp excluded-address 10.0.100.1 10.0.100.100
ip dhcp excluded-address 10.0.1.1 10.0.1.100
ip dhcp excluded-address 10.0.2.1 10.0.2.100
ip dhcp excluded-address 10.0.3.1 10.0.3.100
ip dhcp excluded-address 10.0.4.1 10.0.4.100
ip dhcp excluded-address 10.0.5.1 10.0.5.100
ip dhcp excluded-address 10.0.6.1 10.0.6.100
!
ip dhcp pool dhcppool
network 10.0.100.0 255.255.255.0
@@ -22,6 +28,36 @@ ip dhcp pool dhcppool
dns-server 8.8.8.8 8.8.4.4
lease 7
!
ip dhcp pool dhcp11
network 10.0.1.0 255.255.255.0
default-router 10.0.1.61
lease 7
!
ip dhcp pool dhcp12
network 10.0.2.0 255.255.255.0
default-router 10.0.2.61
lease 7
!
ip dhcp pool dhcp13
network 10.0.3.0 255.255.255.0
default-router 10.0.3.61
lease 7
!
ip dhcp pool dhcp14
network 10.0.4.0 255.255.255.0
default-router 10.0.4.61
lease 7
!
ip dhcp pool dhcp15
network 10.0.5.0 255.255.255.0
default-router 10.0.5.61
lease 7
!
ip dhcp pool dhcp16
network 10.0.6.0 255.255.255.0
default-router 10.0.6.61
lease 7
!
!
spanning-tree mode pvst
spanning-tree portfast default
@@ -167,11 +203,17 @@ ip classless
ip http server
!
access-list 111 permit ip 10.0.1.0 0.0.0.255 host 10.0.100.5
access-list 111 permit udp any eq bootpc any eq bootps
access-list 112 permit ip 10.0.2.0 0.0.0.255 host 10.0.100.5
access-list 112 permit udp any eq bootpc any eq bootps
access-list 113 permit ip 10.0.3.0 0.0.0.255 host 10.0.100.5
access-list 113 permit udp any eq bootpc any eq bootps
access-list 114 permit ip 10.0.4.0 0.0.0.255 host 10.0.100.5
access-list 114 permit udp any eq bootpc any eq bootps
access-list 115 permit ip 10.0.5.0 0.0.0.255 host 10.0.100.5
access-list 115 permit udp any eq bootpc any eq bootps
access-list 116 permit ip 10.0.6.0 0.0.0.255 host 10.0.100.5
access-list 116 permit udp any eq bootpc any eq bootps
!
snmp-server community 1234Five RO
!