Skip to content
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

system: static/MVC hybrid model array vivification issue #3123

Closed
fichtner opened this issue Jan 11, 2019 · 9 comments
Closed

system: static/MVC hybrid model array vivification issue #3123

fichtner opened this issue Jan 11, 2019 · 9 comments
Assignees
Labels
bug Production bug
Milestone

Comments

@fichtner
Copy link
Member

via: https://forum.opnsense.org/index.php?topic=10932.0

@fichtner fichtner self-assigned this Jan 11, 2019
@fichtner fichtner added the bug Production bug label Jan 11, 2019
@fichtner fichtner added this to the 19.1 milestone Jan 11, 2019
@AdSchellevis
Copy link
Member

This looks related (or inflicted) by #3024, feel free to assign me if this is the case.

@fichtner fichtner assigned AdSchellevis and unassigned fichtner Jan 11, 2019
@fichtner
Copy link
Member Author

It goes back a while longer with a rework in inc/ code and that static code has no real iterator that is free of side effects. I think that merging static code and new models is not the way to go anymore although it looked nice to avoid migrations. It just creates bugs further down the road. :(

@AdSchellevis
Copy link
Member

I’m afraid you’re right, it looked simple at first, but maybe complicated later on. In this case we’re stuck in this situation, but it’s likely fixable. I’ll take a look at it when I can.

@fichtner
Copy link
Member Author

fichtner commented Jan 12, 2019

Maybe could drop invalid data from the model on migrations? It would fix itself on updates then...

The issue that caused this is:

foreach (config_read_array('staticroutes', 'route') as $route) {

Damage is done so adding protection here won't be a good solution. :/

config[8336]: Model OPNsense\Routes\Route can't be saved, skip ( Phalcon\Validation\Exception:
[OPNsense\Routes\Route:route.51dc1e9b-6f9d-487f-b05a-ae2ff624040a.network] Specify a valid network matching the gateways ip protocol.
[OPNsense\Routes\Route:route.51dc1e9b-6f9d-487f-b05a-ae2ff624040a.gateway] Specify a valid gateway from the list matching the networks ip protocol.
[OPNsense\Routes\Route:route.51dc1e9b-6f9d-487f-b05a-ae2ff624040a.network] Specify a valid network matching the gateways ip protocol.
[OPNsense\Routes\Route:route.51dc1e9b-6f9d-487f-b05a-ae2ff624040a.gateway] Specify a valid gateway from the list matching the networks ip protocol. in
/usr/local/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php:538 Stack trace: #2177 /usr/local/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php(645): OPNsense\Base\BaseModel->serializeToConfig() #1030 /usr/local/opnsense/mvc/script/run_migrations.php(56): OPNsense\Base\BaseModel->runMigrations() #2 {main} )

@AdSchellevis
Copy link
Member

Dropping data has consequences too, I’ll have to look into it. The risk I see now is when a software update invalidates your model, you might loose connectivity in the worst case.
Let me het back on this, it should be possible to edit the illegal entry, which would make the issue a bit better, although I’m not sure what’s needed to fix that yet.

@christianuhlmann
Copy link

I have the same error in version:
OPNsense 18.7.10-amd64
FreeBSD 11.1-RELEASE-p18
OpenSSL 1.0.2q 20 Nov 2018
actual stable from website

@fichtner
Copy link
Member Author

Yup, edit /conf/config.xml and remove this block:

  <staticroutes>
    <route/>
  </staticroutes>

@christianuhlmann
Copy link

christianuhlmann commented Jan 13, 2019

@fichtner thanks for the info, I have already done this as mentioned in https://forum.opnsense.org/index.php?topic=10962.0

@fichtner
Copy link
Member Author

Works fine, thanks! ❤️

a111b34

# opnsense-patch a111b34

fichtner pushed a commit that referenced this issue Jan 17, 2019
fichtner pushed a commit that referenced this issue Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Production bug
Development

No branches or pull requests

3 participants